acer

32572 Reputation

29 Badges

20 years, 28 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

For input it is exp(...) not e^(...).

The name "e" has no special value in Maple.

The typeset output displays as a bold, upright Roman e^(...) and that is what often confuses people.

restart;                                                                           

uu := (x, y, t) -> exp(.2*t)*(exp(-x)+exp(-y)):                                    

uu(.1, .1, .1);                                                                    

              1.846232693

You could also type the letters exp and then press the Esc key and so use command-completion, in order to get a nicely typeset input like that bold, upright e^....

You could also use the appropriate entry from the Expressions palette., although personally I find that more awkward since your hand has to switch back and forth between keyboard and pointer.

At the top right corner of each Question/Post/Answer you should be able to see a Thumbs-Up icon and a Star icon.

The Star icon is for marking something as one of your favorites. When marked it appears in blue, when unmarked it appears in grey.

Put the Library file (.mla filename extension) in a location that is in the path as specified by libname.

And so one possibility is to put it in a location of your choice, and then to augment libname with that location. 

You could read Answers to several previous, related Questions. Eg. here and here.

A Vector is properly a mutable structure, ie. its entries can be changed in-place.

In consequence, different Vectors are distinct structures, even if they just happen to have the same entries. So a set of such are not reduced by merely apparent duplicates (ie. Vectors having the same entries).

In contrast, lists are not properly mutable; two lists having the same entries point to the same uniquified structure in memory. So a set of equal lists gets duplicates removed.

note: There is some purportedly user-friendly functionality that lets you change a list's entries as if it were acting in-place. But the result is a new and distinct structure, so this is actually faking in-place action.

a := {Vector(2, [1, 0]), Vector(2, [2, 0])}

{Vector[column](%id = 18446883925989928582), Vector[column](%id = 18446883925989928702)}

b := [Vector(2, [1, 0]), Vector(2, [2, 0]), Vector(2, [1, 0])]

[Vector[column](%id = 18446883925992055142), Vector[column](%id = 18446883925992055262), Vector[column](%id = 18446883925992055382)]

c := convert(b, set)

{Vector[column](%id = 18446883925992055142), Vector[column](%id = 18446883925992055262), Vector[column](%id = 18446883925992055382)}

d := [[1, 0], [2, 0], [1, 0]]``

[[1, 0], [2, 0], [1, 0]]

e := convert(d, set)

{[1, 0], [2, 0]}

addressof(b[1]), addressof(b[3])

18446883925992055142, 18446883925992055382

addressof(d[1]), addressof(d[3])

18446883926001396702, 18446883926001396702

b[1][2] := 13; b[1]

Vector[column](%id = 18446883925992055142)

addressof(b[1])

18446883925992055142

d[1][2] := 13; d[1]

[1, 13]

addressof(d[1])

18446883925981769838

``

Download DuplicateEntries_ac.mw

restart:

f := sin(2*t)-sin(3*t)+sin(4*t);

sin(2*t)-sin(3*t)+sin(4*t)

Student:-Calculus1:-Roots(f, t = 0 .. 2*Pi);

[0, (1/3)*Pi, (2/3)*Pi, Pi, (4/3)*Pi, (5/3)*Pi, 2*Pi]

Download SC1Roots.mw

I submitted a bug against solve about three weeks ago -- that it was missing solutions -- in a very similar case (trig, bounded above and below). I will submit this new example.

Someone else mentioned that applying expand worked for this example. For some other examples applying combine works (but not for this example). Another possibility here is to split the domain.

{solve([f, t >= 0, t <= Pi], allsolutions, explicit)}
union
{solve([f, t >= Pi, t <= 2*Pi], allsolutions, explicit)};

  /                                /    1   \    /    2   \   
 { {t = 0}, {t = Pi}, {t = 2 Pi}, { t = - Pi }, { t = - Pi }, 
  \                                \    3   /    \    3   /   

    /    4   \    /    5   \ \ 
   { t = - Pi }, { t = - Pi } }
    \    3   /    \    3   / / 

For any of these workarounds one can find similar examples for which it fails while some others succeed.

None of these workarounds seems as robust as Calculus1:-Roots, for some restricted flavour of problem.

That should be
   with(GeM):
instead of,
   With(GeM):
as you showed it.

If that's not your problem then you should upload and attach you worksheet.

restart;

phi := (1+sqrt(5))/2:

plots:-pointplot([seq([n, sin(n*phi)], n = 1000 .. 2000)],
                  symbol = point, axes = boxed, size=[250,250],
                  labels = [n, eval('Typesetting:-Typeset'(sin(sort('n*phi',
                                                                 order=plex('phi','n')))))],
                  labeldirections = [horizontal, vertical]);

restart;

phi := (1+sqrt(5))/2:

plots:-pointplot([seq([n, sin(n*phi)], n = 1000 .. 2000)],
                  symbol = point, axes = boxed, size=[250,250],
                  labels = [n,sin(`#mrow(mo("&phi;"),mo("&InvisibleTimes;"),mi("n"));`)],
                  labeldirections = [horizontal, vertical]);

 

Download label_ts.mw

I don't mind having to force the desired ordering of the terms in the product. But it would be much better if typeset were not so weak (ie. if it were to do the full job of typesetting to a form that were not fragile w.r.t. subsequent reordering or evaluation). It's not very user-friendly, to have to go to so much effort to produce a more robust result.

You asked why it happens. It happens because that's of how convert(..,string) is handling it, using the %a format.

You might prefer to force the %g format instead.

sprintf("%g",0.12);

              "0.12"

As for your convert call, it does this:

sprintf("%a",0.12);

              ".12"

> trace(sprintf):
> convert(0.12,string);
{--> enter sprintf, args = "%a", .12
              ".12"

<-- exit sprintf (now in `convert/string`) = ".12"}
              ".12"

What do you think about the following?

restart;

expr := exp(I*x);

exp(I*x)

eq := expr = evalc(expr);

exp(I*x) = cos(x)+I*sin(x)

eval( eq, x=I);

exp(-1) = cosh(1)-sinh(1)

convert(%, exp);

exp(-1) = exp(-1)

cos(I);

cosh(1)

sin(I);

I*sinh(1)

I*sin(I);

-sinh(1)

Download eu.mw

If I understand what you're after then this seems to accomplish that last simplification, and also gets the earlier rational part in another manner.

maxcharheight_ac.mw

[edit] I will submit a bug report against simplify, for the following:

ee := exp(2*ln(1/2 - sqrt(5))*sqrt(5)):

simplify(ee); # hmm

   exp(2*(-ln(2)+ln(-1+2*5^(1/2))+I*Pi)*5^(1/2))

simplify(expand(ee));

    (1/2-5^(1/2))^(2*5^(1/2))

simplify(ee,exp);

    (1/2-5^(1/2))^(2*5^(1/2))

This is one way to get what you asked, "captions fig.1,fig.2,fig.3,fig.4 in the Tabulate command ( variable G) without taking into account the random order of the graphs".

TEST_-_Copie_ac1.mw

Hopefully you have asked for that which you actually want.

Here is one way that your example can be handled.

restart;

eq := a[n]=b*c[n]/d^2*(e+f[n])/g;

a[n] = b*c[n]*(e+f[n])/(d^2*g)

teq := c[n]*(e+f[n])=__u:

eval(isolate(simplify(eq,{teq}),__u),(rhs=lhs)(teq));

c[n]*(e+f[n]) = a[n]*d^2*g/b

Download isolate_ex.mw

You could also use solve instead of isolate. Variations can handle some cases where there are multiple solutions from solve. For some examples algsubs could be used instead of simplify (simplify with side-relations), to do the temporary substitution by a dummy name.

Are you also going to have examples where you want to treat the (smallest?) arithmetic subexpression that contains the target names, eg. both c[n] and f[n] present, say, but without your having to specify that explicitly? A clear and precise characterization of your possible examples may help.

I'm not sure that I understand your scenario. But perhaps this is close.

(edit: I am not providing you with the direct approach of simply multiplying a symbol by a unit, eg. pp:=p*Unit(m). I had imagined that you were asking about something more complicated.)

restart;

kernelopts(version);

`Maple 2021.1, X86 64 LINUX, May 19 2021, Build ID 1539851`

 

U := proc(x, u)
  if not x::complexcons then return 'procname'(x,u);
  else x*u; end if;
end proc:
`print/U` := proc(x) x; end proc:

 

pp := U(p,Unit(m));

U(p, Units:-Unit(m))

qq := U(q,Unit(s));

U(q, Units:-Unit(s))

 

Now pp and qq print nicely as just p and q. And you can substitute
numeric values for names p or q and have the units appear.

 

 

expr1 := pp*qq;

U(p, Units:-Unit(m))*U(q, Units:-Unit(s))

Now a substitution (evaluation at a point).

eval(expr1, [p=4, q=3]);

12*Units:-Unit(m)*Units:-Unit(s)

expr2 := 7*Unit(cm*s) + pp*qq;

7*Units:-Unit(cm*s)+U(p, Units:-Unit(m))*U(q, Units:-Unit(s))

Now another substituion at a point.

eval(expr2, [p=5.5, q=2.1]);

7*Units:-Unit(cm*s)+11.55*Units:-Unit(m)*Units:-Unit(s)

combine(%,units);

11.62000000*Units:-Unit(m*s)

The combining of units can be made mostly automatic.
(You don't have to make this happen automatically.)

with(Units:-Simple):

 

eval(expr2, [p=5.5, q=2.1]);

11.62000000*Units:-Unit(m*s)

Download units_hidden.mw

The implicitdiff command gives the following, directly and staightforwardly.

restart;

implicitdiff({2*x*y^3+3*x^2*y=1},{x(y)},{x},y,notation=Diff)[1];

Diff(x, y) = -(3/2)*x*(2*y^2+x)/(y*(y^2+3*x))

 

If you need the terms massaged.

 

lhs(%)=sign(numer(rhs(%)))
       *expand(numer(rhs(%))/sign(numer(rhs(%))))/expand(denom(rhs(%)));

Diff(x, y) = -(6*x*y^2+3*x^2)/(2*y^3+6*x*y)

Download implicitdiff_ex.mw

Firstly, try not to use the word "function" if you find yourself in a muddle with expressions (that depend on name t) versus operators (whose formal parameter dummy name just happens to be t). Otherwise you might be using the word ambiguously.

restart;


Here f is an expression that depends on t. There
are no operators in play here.

f := sin(x(t));

sin(x(t))

diff(f, t);

(diff(x(t), t))*cos(x(t))

restart;


Here f is an operator. It is not an expression that
depends on t.

f := t -> sin(x(t));

proc (t) options operator, arrow; sin(x(t)) end proc


But f(t) is an expression that depends on t, after
applying the operator f to t.

f(t);

sin(x(t))

diff(f(t), t);

(diff(x(t), t))*cos(x(t))


If you really want you could construct a new
operator from that.

unapply(%, t);

proc (t) options operator, arrow; (diff(x(t), t))*cos(x(t)) end proc


Alternatively we can directly construct a new
operator which returns the derivative (wrt t) of
what f returns.

D(f);

proc (t) options operator, arrow; (D(x))(t)*cos(x(t)) end proc


We can also apply that new operator to t. This
produces an expression that depends on t.

D(f)(t);

(D(x))(t)*cos(x(t))


We could now also convert that expression
from D form to active diff form.

convert(%, diff);

(diff(x(t), t))*cos(x(t))

 

Download differentiation_expr_vs_operator.mw

Also, note that Diff is an inert version of active diff. Your goal is to actively differentiate, so using inert Diff would just add more muddle here.

First 81 82 83 84 85 86 87 Last Page 83 of 338