acer

32385 Reputation

29 Badges

19 years, 334 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

restart;
kernelopts(version);

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

Ftarg := 1/2+signum(x-mu)/(2*GAMMA(1/beta))
             *(GAMMA(1/beta)-GAMMA(1/beta, abs((x-mu)/sigma)^beta)):

f := beta/(2*sigma*GAMMA(1/beta))*exp(-(abs(x-mu)/sigma)^beta):

conds := x::real, mu::real, beta > 0, sigma > 0:

simplify( diff(Ftarg, x) - f ) assuming Or(x>mu, x<mu), conds;

                       0

In some older versions such as Maple 2015 you could split that into separate integrations for x>mu and x<mu.

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

First 79 80 81 82 83 84 85 Last Page 81 of 336