acer

32368 Reputation

29 Badges

19 years, 333 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Compare what you have done, with these choices for the tickmarks option:

tickmarks = [tickList, tickList, default]

tickmarks = [tickList, tickList, [0=0,1=1]]

tickmarks = [tickList, tickList, [op(map(rhs=rhs,rtable_elems(B))), 0=0]]

(The last two of those should give the same effect, for your B. I mentioned the last once only in case you later start putting in other values within B and want it to pick them up automatically.)

restart;

fseqn := (Se, f) -> Se^(f+1):

Vector(5, j->fseqn(2.1, j));

                      [  4.41   ]
                      [         ]
                      [  9.261  ]
                      [         ]
                      [ 19.4481 ]
                      [         ]
                      [40.84101 ]
                      [         ]
                      [85.766121]

Please try working with methods suggested for your earlier, very similar Questions, before asking even more on this theme.

restart;

kernelopts(version);

`Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895`

randomize():

 

ee := InertForm:-MakeInert( 'log[a]'(b*x+c) ):

InertForm:-Display(ee, inert=false);

log[a](b*x+c)

value(ee);

ln(b*x+c)/ln(a)

rand1:=rand(2..9):

a,b,c := rand1(),rand1(),rand1();

2, 7, 3

InertForm:-Display(ee, inert=false);

log[2](7*x+3)

value(ee);

ln(7*x+3)/ln(2)

 

Download another.mw

It's interesting that this works:

int(diff(f(x,y),x)*g(x)+f(x,y)*diff(g(x),x), x);

                          f(x, y) g(x)

For your goal, could you get dsolve to do it for you?

de := diff(K(x,y),x) = diff(f(x,y),x)*g(x,y)+f(x,y)*diff(g(x,y),x):

raw := dsolve({de}):

raw[1];

           {K(x, y) = _F1(y), f(x, y) = 0, g(x, y) = g(x, y)}

raw[2];

   /                                                K(x, y) + _F1(y) \
  { K(x, y) = K(x, y), f(x, y) = f(x, y), g(x, y) = ----------------  }
   \                                                    f(x, y)      /

solve(raw[2], K(x,y));

                  {K(x, y) = g(x, y) f(x, y) - _F1(y)}

The command LibraryTools:-Save is for storing in a .mla Maple Library Archive file. (And you'd first use LibraryTools:-Create once, to create the .mla file.) There is no corresponding "read" action necessary or relevant. But this does not seems to be what you're attempting.

If you want to save as plaintext in an .mpl file then you should use the command save instead and supply a filename which has the ".mpl" extension. In that case it doesn't have to be inside any special folder. You get it in future sessions using the read command.

The purpose of putting .mla archives within special folders under cat(kernelopts(homedir), "/maple/toolbox") is that those get automagically added to libname upon restart. The kernel finds things in archives in libname automatically, without any need for "read".

Placing your .mpl files directly within a toolbox lib subdirectory seems confusing to me, especially since there is no special benefit for doing so. It might be more logical to use a subdirectory named src instead.

Make sure your target directory exists.

You do not need to assign to the varuable names v1,v2,etc which would have the drawback that you'd need to unassign them in order to re-use then conveniently as names. You can accomplish the same effects using a list of equations or a table, either of which can be used to associate the names with the values.

This is a common and important usage scenario in Maple.

restart;

List1 := [v1,v2,v3,v4];

[v1, v2, v3, v4]

List2 := [a*b/c, a/c,a*b-2,d];

[a*b/c, a/c, a*b-2, d]

R := Equate(List1,List2);

[v1 = a*b/c, v2 = a/c, v3 = a*b-2, v4 = d]

expr := sin(x*y);

sin(x*y)

f := a*diff(expr,x)+b*diff(expr,y)+ a*b:

eval(f, [a=v1,b=v2]);

v1*y*cos(x*y)+v2*x*cos(x*y)+v1*v2

eval(f, eval([a=v1,b=v3],R));

a*b*y*cos(x*y)/c+(a*b-2)*x*cos(x*y)+a*b*(a*b-2)/c

eval(f, eval([a=v4,b=v2],R));

d*y*cos(x*y)+a*x*cos(x*y)/c+d*a/c

T:=table(R);

table( [( v4 ) = d, ( v3 ) = a*b-2, ( v2 ) = a/c, ( v1 ) = a*b/c ] )

eval(f, [a=T[v1],b=T[v3]]);

a*b*y*cos(x*y)/c+(a*b-2)*x*cos(x*y)+a*b*(a*b-2)/c

eval(f, [a=T[v4],b=T[v2]]);

d*y*cos(x*y)+a*x*cos(x*y)/c+d*a/c

func := unapply(f, [a,b]);

proc (a, b) options operator, arrow; a*y*cos(x*y)+b*x*cos(x*y)+b*a end proc

func(v1,v3);

v1*y*cos(x*y)+v3*x*cos(x*y)+v3*v1

func(T[v1],T[v3]);

a*b*y*cos(x*y)/c+(a*b-2)*x*cos(x*y)+a*b*(a*b-2)/c

func(T[v4],T[v2]);

d*y*cos(x*y)+a*x*cos(x*y)/c+d*a/c

 

Download funcsubs.mw

The leading term is determined lexicographically (here, alphabetically, but where lower/uppercase matters).

And so what matters for -v1+a is the coefficient of a , while what matters for -V1+a is the coefficient of V1.  The capital letters are taken first.

Maple needs to use some convention in your usage case where no variable list is supplied as additonal argument. It might make sense (albeit tiresomely) to complain about the particular convention used, but it would make no sense to complain that it has to have some convention.

[edit] I should point out that for important efficiency concerns Maple stores only one instance of a polynomial in memory, regardless of whether it is entered as -v1+a or later as a-v1 . Moreover a polynomial can have its subterms sorted inplace in memory, but that structural change should not affect the result from sign which is mathematical. Therefore its leading term cannot be determined by the order in which you later re-type it or the order in which the subterms are stored in memory. So a convention that considers the leading term lexicographically lets things work.

restart;
p := -V1 + a;
                          p := -V1 + a

sign(p);
                               -1

sort(p,order=plex(V1,a),ascending);
                             a - V1

p;
                             a - V1

sign(p);
                               -1

sort(p,order=plex(V1,a),descending);
                            -V1 + a

p;
                            -V1 + a

sign(p);
                               -1

Since Maple 15 it is even easier to set the default unit for a particular dimension with the UseUnit command. I mean easier than having to use the commands AddSystem and UseSystem as you did above.

This allows other scales of power to be simplified to your desired kWh/day.

You can utilize it with or without loading Units:-Standard, depending on whether you want arithmetic with units to resolve/combine automatically. Or in recent versions you can utilize it alongside Units:-Simple, which does that automatic combining of units while also allow mixed arithmetic of quantities with units attached and unknown quantities (eg. names) without units specified.

restart;

kernelopts(version);

`Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750`

Units:-UseUnit(kWh/day):

expr1 := 4.9*Unit(kW)*3.5*Unit(h/day);

17.15*Units:-Unit(kW)*Units:-Unit(h/d)

combine(expr1, units); # no change, as desired

17.15*Units:-Unit(kWh/d)

expr2 := 1700.1*Unit(W);

1700.1*Units:-Unit(W)

combine(expr2, units);

40.80240000*Units:-Unit(kWh/d)

simplify(expr2);

40.80240000*Units:-Unit(kWh/d)

restart;

Units:-UseUnit(kWh/day):

with(Units:-Standard):

4.9*Unit(kW)*3.5*Unit(h/day);

17.15*Units:-Unit(kWh/d)

simplify(1700.1*Unit(W));

40.80240000*Units:-Unit(kWh/d)

1700.1*Unit(W)*3.4*Unit(days/week);

19.81830857*Units:-Unit(kWh/d)

restart;

Units:-UseUnit(kWh/day):

with(Units:-Simple):

4.9*Unit(kW)*3.5*Unit(h/day) + x;

17.15*Units:-Unit(kWh/d)+x

simplify(1700.1*Unit(W) - u);

1700.1*Units:-Unit(W)-u

1700.1*Unit(W)*3.4*Unit(days/week) + 40.5*k;

19.81830857*Units:-Unit(kWh/d)+40.5*k

 

Download useunit.mw

There are also facilities for right-click units re-formatting in the Maple 2018 GUI. You can also use that (or convert(...,units,W) ) to force display in Watts alone.

@primogen Have you tried,

Physics:-diff~(SimplifiedMassMatrixDot, theta[2](t));

a_ac.mw

I toggled this Question to be marked as "Maple 2017", since that's the release in which your attachment was last saved. (You had it as "Maple 17" which is four major releases earlier.)

I don't know of any easy way to handle 2D Input of units (ie. typeset via command-completion, or from the Units palette).

The following affects 2D Output. (I doubt it will work alongside right-click unit-formatting.)

restart;

kernelopts(version);

`Maple 2018.1, X86 64 LINUX, Jun 8 2018, Build ID 1321769`

 

Unit(88*kg*m/s^2) + Unit(g)*Unit(-3*cm/s^2);

88*Units:-Unit(kg*m/s^2)-3*Units:-Unit(g)*Units:-Unit(cm/s^2)

 

ChangeUnitsColor:=proc(c, {bold::truefalse:=false})
  global `print/Unit`;
  local hexstr;
  uses ColorTools;
  if c = ':-default' then
    `print/Unit`:='`print/Unit`';
    return NULL;
  end if;
  hexstr:=RGB24ToHex(RGBToRGB24([ColorTools:-Color(c)[]]));
  `print/Unit`:=subs(__dummy=hexstr,
      proc(x)
      local r;
      uses T=Typesetting;
      if interface(':-prettyprint')<2 then
        return Units:-Unit(args);
      end if;
      r:=subsindets(T:-Typeset(x),
                    ':-specfunc'({T:-mrow,T:-mi,T:-mo,
                                  T:-mfrac,T:-msup,T:-msqrt}),
                    u->op(0,u)(op(u),
                               "mathcolor"=__dummy));
      r:=subsindets(r,specfunc({T:-mi,T:-mo}),
                    u->T:-mtext(op(u)));
      if bold=true then
        r:=T:-mstyle(r, 'italic'="false", ':-fontweight'="bold");
      end if;
      return r;
    end proc);
  NULL;
end proc:

 

ChangeUnitsColor("Red");

Unit(kg^(1/2));

Units:-Unit(kg^(1/2))

Unit(s/m)+Unit(day/cm);

Units:-Unit(s/m)+Units:-Unit(d/cm)

simplify(Unit(s/m)+Unit(day/cm));

8640001*Units:-Unit(s/m)

ChangeUnitsColor("Green");

sin(x)*Unit(8.8*kg*m/s^2) + Unit(g)*Unit(-3*cm/s^2);

8.8*sin(x)*Units:-Unit(kg*m/s^2)-3*Units:-Unit(g)*Units:-Unit(cm/s^2)

combine(%, units);

(8.8*sin(x)-3/100000)*Units:-Unit(N)

ChangeUnitsColor("Blue", bold);

sin(x)*Unit(8.8*kg*m/s^2) + Unit(-3*g*cm/s^2);

8.8*sin(x)*Units:-Unit(kg*m/s^2)-3*Units:-Unit(g*cm/s^2)

Unit(43*'kg'^2)

43*Units:-Unit(kg^2)

ChangeUnitsColor(default);

sin(x)*Unit(8.8*kg*m/s^2) + Unit(g)*Unit(-3*cm/s^2);

8.8*sin(x)*Units:-Unit(kg*m/s^2)-3*Units:-Unit(g)*Units:-Unit(cm/s^2)

``

Download unitcolorbold.mw

restart;

g := x -> (2*x-7)^('-3');

proc (x) options operator, arrow; (2*x-7)^'-3' end proc

new := InertForm:-MakeInert(g(x)):

InertForm:-Display(new,inert=false);

0, "%1 is not a command in the %2 package", _Hold, Typesetting

g(6);

1/125

other := subs(x=6, new):

InertForm:-Display(other, inert=false);

0, "%1 is not a command in the %2 package", _Hold, Typesetting

value(other);

1/125

map[2](op,2,indets(g(x), `^`));

{-3}

-degree(denom(g(x)),x);

-3

 

Download inertanother.mw

restart;

kernelopts(version);

`Maple 2018.1, X86 64 LINUX, Jun 8 2018, Build ID 1321769`

assume(x>0);

expr := sqrt(x^3*x^(3/4));

(x^(15/4))^(1/2)

new := combine(expr);

x^(15/8)

map[2](op,2,indets(new,identical(x)^anything));

{15/8}

restart;

expr := surd(a*'surd'(a*a^b,2),4);

surd(a*surd(a*a^b, 2), 4)

inertexpr := InertForm:-MakeInert(eval(expr,1)):

new := subs([a=2,b=6,c=4], inertexpr):

ans := InertForm:-Display(new, inert=false);

Typesetting:-mcomplete(Typesetting:-mroot(Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mn("2"), Typesetting:-mo("&sdot;"), Typesetting:-mcomplete(Typesetting:-mroot(Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mn("2"), Typesetting:-mo("&sdot;"), Typesetting:-mcomplete(Typesetting:-msup(Typesetting:-mrow(Typesetting:-mn("2")), Typesetting:-mn("6"), Typesetting:-msemantics = "^"), Typesetting:-_Hold([`%^`(2, 6)]))), Typesetting:-_Hold([`%*`(2, `%^`(2, 6))])), Typesetting:-mn("2")), Typesetting:-_Hold([%surd(`%*`(2, `%^`(2, 6)), 2)]))), Typesetting:-_Hold([`%*`(2, %surd(`%*`(2, `%^`(2, 6)), 2))])), Typesetting:-mn("4")), Typesetting:-_Hold([%surd(`%*`(2, %surd(`%*`(2, `%^`(2, 6)), 2)), 4)]))

InertForm:-Value(new);

2*2^(1/8)

 

Download inertsurd.mw

The multiple assignment functionality was added in Maple V R5 which was released in 1997.

Have you tried,

display(Array([ display(A,B), C ]));

More importantly, Shouldn't you call it like,

Explore( P(a), parameters=[a=-1.0..1.0] );

so that it explores a function call to P?

Yes, you should be to accomplish this using Embedded Components, as long as the data exists before the plotting begins.

If you're hoping for an asynchronous process that sits there waiting for newly computed data points to be added to the file then the task is much more complicated (if possible at all).

Do you have a sample of data? What kind of plot do you want?

First 170 171 172 173 174 175 176 Last Page 172 of 336