acer

32333 Reputation

29 Badges

19 years, 326 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

It happens because GAMMA(n,1) is returning a result with exp(-1) rather than 1/exp(1).

The product of terms exp(1) * 1/exp(1) would simplify (even automatically). But the mathematically equivalent product exp(1) * exp(-1) requires an explicit simplifying step such as a call to simplify or combine.

restart;

r := rsolve({u(n)=n*(u(n-1)+1), u(0)=0}, u);

GAMMA(n+1)*(Sum((n1+1)/GAMMA(n1+2), n1 = 0 .. n-1))

R:=unapply(simplify(value(r)),n);

proc (n) options operator, arrow; n*exp(1)*GAMMA(n, 1) end proc

seq(R(i), i=0..5);

0, exp(1)*exp(-1), 4*exp(1)*exp(-1), 15*exp(1)*exp(-1), 64*exp(1)*exp(-1), 325*exp(1)*exp(-1)

 

S:=unapply('combine'(simplify(value(r)),exp),n);

proc (n) options operator, arrow; combine(n*exp(1)*GAMMA(n, 1), exp) end proc

seq(S(i), i=0..5);

0, 1, 4, 15, 64, 325

 


Download exp_combine.mw

I started and finished my Answer before I saw vv's fine Answer. I figured that I'd submit anyway (because I had an explanation), while up-voting `vv`.

There are several ways to show that this particular expression equals zero, step-by-step using Maple. Here's one:

restart;

 

ee:=-3*(sqrt(10+4*sqrt(5)))+sqrt(50+20*sqrt(5))+sqrt(10-4*sqrt(5))+sqrt(50-20*sqrt(5));

-3*(10+4*5^(1/2))^(1/2)+(50+20*5^(1/2))^(1/2)+(10-4*5^(1/2))^(1/2)+(50-20*5^(1/2))^(1/2)

# These are all the terms in the sum.
[op(ee)];

[-3*(10+4*5^(1/2))^(1/2), (50+20*5^(1/2))^(1/2), (10-4*5^(1/2))^(1/2), (50-20*5^(1/2))^(1/2)]

# Pick one.
op(3,ee);

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

# Multiply each term by that.
map(u->op(3,ee)*u, [op(ee)]);

[-3*(10-4*5^(1/2))^(1/2)*(10+4*5^(1/2))^(1/2), (10-4*5^(1/2))^(1/2)*(50+20*5^(1/2))^(1/2), 10-4*5^(1/2), (10-4*5^(1/2))^(1/2)*(50-20*5^(1/2))^(1/2)]

# Combine radicals.
map(combine, %);

[-6*((5-2*5^(1/2))*(5+2*5^(1/2)))^(1/2), 2*5^(1/2)*((5-2*5^(1/2))*(5+2*5^(1/2)))^(1/2), 10-4*5^(1/2), 2*5^(1/2)*(5-2*5^(1/2))]

# Expand the products within the radicals.
map(expand, %);

[-6*5^(1/2), 10, 10-4*5^(1/2), 10*5^(1/2)-20]

# These are all the original terms, scaled.
op(%);

-6*5^(1/2), 10, 10-4*5^(1/2), 10*5^(1/2)-20

# Add them together.
`+`(%);

0

 

 

rad.mw

The numerators of the values of A4[3,3] and A4[4,4] are not the integer 1. They are both a so-called Atomic Variable (atomic identifier, or name) that merely looks like a 1.

If I delete those two entries are instead re-type both as -1/TW then the Eigenvalues command returns complex floating-point results as one would normally expect for A4 a floating-point Matrix.

Eignevalues_1.mw

I'm not sure how you managed to get those numerators for be that name (which displays like 1, but which is not actually an integer.) Presumably it was not due to some deliberate action of your own. I suspect a bug/quirk in the Matrix palette (which you appear to have used to get the typeset 2D Input for the Matrix entry). There were some bugs related to the Matrix palette in the earlier point-releases of Maple 2017 (eg, 2017.0, etc). Your attachment was last saved using Maple 2017.3 so I guess you've already updgraded and perhaps there may still be some issues with the Matrix palette. Do you recall doing anything different for entering those Matrix elements?

Here in the attached worksheet is one way, using different names for the 3 points used for each triangle. This way will allow you to operate with the triangles stored as tabl[i] without having to immediately draw them (producing actual, distinct plots right away).

tri.mw

Another way involves giving up on storing them as mere triangle things (rather than as final plots) in the tabl[i], and storing their respective plots instead. (I use a different table name, P instead of tabl, just to make it a little more clear).

tri2.mw

This homework/coursework question has been asked and answered recently by others. See here for one explanation.

I showed a similar thing here, using the events functionality of numeric dsolve.

(I also showed it there using Optimization:-Minimize.)

Every call to DocumentTools:-InsertContent entirely replaces any content in the sole Task Region that an Execution Group can have.

In other words, each time through your loop the InsertContent call will wipe out whatever was inserted the previous call.

You cannot work around this with the kind of looped call to InsertContent call that you have.

You can only work around it by inserting xml content which itself contains all the augmented content.

Eg, hyperlink_do-loop_1.mw

So you can use a seq call within the construction. But you cannot succeed doing any looped call to InsertContent.

You have other choices, about what to enclose within such a seq call. It needn't be of the form seq(Group(Input(...)),...) but instead could be different hyperlinks in a sequence of Cells in a Row, or a particular Cell in each of a sequence of Rows in a Table, or a particular Cell in a sequence of subTables within whatever, etc.

My personal preference for such tasks is to try and target any actions by expand, simplify, combine, etc, to only those which are necessary, in as much as that might be possible.

Restricting use of simplify can be more important, since it can turn ln,exp to arctrig,trig form.

This version also separates factors which do not contain any of the names, or those which are not separable. It handles 1, 2, or more arbitrary names.

restart;

F:=proc(ee,vars::list,{pullcontent::truefalse:=false})
  local Finner;
  Finner:=proc(ee,i::posint,vars::list)
    local p1,p2,K;
    if i>nops(vars) then return ee; end if;
    K := [(u->`if`(u::`*`,op(u),u))(subsindets(ee,{`^`,'specfunc(exp)'},
                                               expand))];
    p1,p2 := selectremove(u->has(u,vars[i]) and {seq(has(u,v),
                                  v=[vars[..i-1][],
                                     vars[i+1..][]])}={false},K);
    p1 := `if`(nops(p1)=0,1,`if`(nops(p1)=1,``(op(p1)),``(`*`(op(p1)))));
    p2 := `if`(nops(p2)=0,1,`if`(nops(p2)=1,op(p2),`*`(op(p2))));
    if nops(vars)>i then
      p2 := procname(p2,i+1,vars);
    end if;
    p1*`if`(i=nops(vars) and p2<>1,``(p2),p2);
  end proc;
  if ee::`*` then `*`(Finner(ee,1,vars)); else ee; end if;
end proc:

expr := a/b^2;

a/b^2

F( expr, [a,b] );

``(a)*``(1/b^2)

expr := exp(a)*13.5/b;

13.5*exp(a)/b

F( expr, [a,b] );

``(exp(a))*``(1/b)*``(13.5)

expr := (x^2+1)*y^3*exp(-x-y);

(x^2+1)*y^3*exp(-x-y)

F( expr, [x,y] );

``((x^2+1)/exp(x))*``(y^3/exp(y))

expr := -(x^2+1)*y^3*exp(-x-y);

-(x^2+1)*y^3*exp(-x-y)

F( expr, [x,y] );

``((x^2+1)/exp(x))*``(y^3/exp(y))*``(-1)

expr := -Pi*(1-cos(x)^2)*sin(y)^3/exp(1);

-Pi*(1-cos(x)^2)*sin(y)^3/exp(1)

F( expr, [x,y] );

``(1-cos(x)^2)*``(sin(y)^3)*``(-Pi/exp(1))

expr := (x^2+1)*z^3*exp(-x-y+h(y))*3/4*cos(x+a)/g(z);

(3/4)*(x^2+1)*z^3*exp(-x-y+h(y))*cos(x+a)/g(z)

F( expr, [x,y,z] );

``((x^2+1)*cos(x+a)/exp(x))*``(exp(h(y))/exp(y))*``(z^3/g(z))*``(3/4)

expr := (x^2+1)*y^3*p^(-x-y+b+z)*2*z/3*exp(x*q)*(1-sin(a)^2)*ln(abs(x)*abs(a));

(2/3)*(x^2+1)*y^3*p^(-x-y+b+z)*z*exp(x*q)*(1-sin(a)^2)*ln(abs(x)*abs(a))

F( expr, [x,y,z] );

``((x^2+1)*exp(x*q)*ln(abs(x)*abs(a))/p^x)*``(y^3/p^y)*``(p^z*z)*``((2/3)*p^b*(1-sin(a)^2))

 


Download splitprod.mw

No, that is not offered through Maple for that computation (ie. grinding it out via `isprime`, as opposed to lookup via NumberTheory:-IsMersenne).

Let me know if you'd really rather have the phi details inside the plot (which could be done using a fancy textplot).

restart

L := 7; with(plots); Digits := 30; rf := 997.1; cpf := 4179; kf := .613; bf := 21; sf := 0.5e-1; rs := 8933; cps := 385; ks := 400; bs := 1.67; ss := 5.96*10^7; a[1] := 0; a[2] := 2; a[3] := 5; a[4] := .6; a[5] := 4; a[6] := 6; phi := .1; lambda := .2; Ha := 1; Gr := 2; alpha := .5; Rd := .5; Ecy := 2; Pr := 3.97; Ecx := .3; A := 1; HA := [a[1], a[2], a[3]]

Ha := Pram; Eq1 := (diff(F(eta), eta, eta, eta))/((1-phi+rs*phi/rf)*(1-phi)^2.5)+(F(eta)+G(eta))*(diff(F(eta), eta, eta))-(2*(diff(F(eta), eta)+diff(G(eta), eta)))*(diff(F(eta), eta))+4*lambda*(diff(G(eta), eta))+(1-phi+rs*bs*phi/(rf*bf))*Gr*H(eta)/(1-phi+rs*phi/rf)-Ha^2*(1+(3*(ss/sf-1))*phi/(ss/sf+2-(ss/sf-1)*phi))*(diff(F(eta), eta))/(1-phi+rs*phi/rf) = 0; Eq2 := (diff(G(eta), eta, eta, eta))/((1-phi+rs*phi/rf)*(1-phi)^2.5)+(F(eta)+G(eta))*(diff(G(eta), eta, eta))-(2*(diff(F(eta), eta)+diff(G(eta), eta)))*(diff(G(eta), eta))-4*lambda*(diff(F(eta), eta))+(1-phi+rs*bs*phi/(rf*bf))*Gr*H(eta)/(1-phi+rs*phi/rf)-Ha^2*(1+(3*(ss/sf-1))*phi/(ss/sf+2-(ss/sf-1)*phi))*(diff(G(eta), eta))/(1-phi+rs*phi/rf) = 0; Eq3 := (ks+(m-1)*kf-(m-1)*(kf-ks)*phi)*(diff(H(eta), eta, eta))/(Pr*(ks+(m-1)*kf+(kf-ks)*phi))+(1-phi+rs*cps*phi/(rf*cpf))*((F(eta)+G(eta))*(diff(H(eta), eta))-A*(diff(F(eta), eta)+diff(G(eta), eta))*H(eta))+Ecx*Ecy*((diff(F(eta), eta, eta))^2+(diff(G(eta), eta))^2)/(1-phi)^2.5 = 0

IC1 := F(0) = 0, (D(F))(0) = 1, G(0) = 0, (D(G))(0) = alpha, H(0) = 1, (D(F))(L) = 0, (D(G))(L) = 0, H(L) = 0
params := {B111 = .2}

[0, 2, 5]

for k to nops(HA) do P || k := plots:-odeplot(dsolve(eval({Eq1, Eq2, Eq3, IC1}, `union`(params, {Pram = HA[k], m = 3})), numeric), [[eta, diff(F(eta), eta)]], linestyle = [dashdot, spacedash, dash, longdash][k], color = [blue, blue, blue, blue][k], labels = [eta, f], thickness = 3); Q || k := plots:-odeplot(dsolve(eval({Eq1, Eq2, Eq3, IC1}, `union`(params, {Pram = HA[k], m = 6.3698})), numeric), [[eta, diff(F(eta), eta)]], linestyle = [dashdot, spacedash, dash, longdash][k], color = [green, green, green, green][k], labels = [eta, theta], thickness = 3); R || k := plots:-odeplot(dsolve(eval({Eq1, Eq2, Eq3, IC1}, `union`(params, {Pram = HA[k], m = 16.1576})), numeric), [[eta, diff(F(eta), eta)]], linestyle = [dashdot, spacedash, dash, longdash][k], color = [red, red, red, red][k], labels = [eta, theta], thickness = 3) end do; f1 := plots:-display(P || (1 .. nops(HA))); f2 := plots:-display(Q || (1 .. nops(HA))); f3 := plots:-display(R || (1 .. nops(HA)))

display(f1, f2, f3, axes = boxed, size = [400, 460], labels = [eta, "&phi;(&eta;)"], labelfont = ["Arial", 10, Bold], labeldirections = [horizontal, vertical], axesfont = ["ROMAN", 10], plot([-1, -1, -1], 3 .. 4, color = [blue, green, red], legend = [typeset('phi' = 3), typeset('phi' = 6), typeset('phi' = 13)], legendstyle = [font = ["ROMAN", bold, 10], location = top]), plots:-textplot([1.5, .8, typeset('delta' = .1, .3, .5)], font = ["ROMAN", bold, 10]), view = [default, 0 .. 1])

``

 

 

Legend_1.mw

Using the menubar, select to View -> Show/Hide Contents...  and in the popup dialogue that appears toggle off Execution Group Boundaries.

Note this is a property of the Worksheet itself, rather than a global setting. Which means when the sheet is saved it retains the property when re-opened (by you or someone else). It also won't affect other newly opened sheets. 

restart;

 

simplify( [solve({x=r*cos(theta), y=r*sin(theta)}, {r,theta},
                 explicit, useassumptions)] )[]
   assuming x::real, y::real, r>0;

{r = (x^2+y^2)^(1/2), theta = arctan(y, x)}

restart;

 

simplify( [solve({r>0,x=r*cos(theta), y=r*sin(theta)}, {r,theta},
                 explicit, useassumptions)] )[]
   assuming x::real, y::real;

{r = (x^2+y^2)^(1/2), theta = arctan(y, x)}

 


Download solve_r.mw

For AudioTools:-Preview to recognize a float[8] Array as an audio thing it has to have certain attributes.

In Maple 2017 the Statistics:-MovingAverage operation does not return an Array with the attributes of the original its input Array. But in Maple 12.02 that command did do that.

I don't really understand how a computation like that done by Statistics:-MovingAverage could sensibly just copy over values for audio qualities like sampling rate. Simply giving the same audio attributes to the returned result doesn't make much sense to me. Perhaps even more importantly, what about the case that someone has used atttributes to mean something else entirely, for which blind copying over of attributes bu MovingAverage might make no sense at all.

Perhaps audio things could be implemented as objects. Then their data could be extracted on demand, but it'd be more obvious that manipulations of such data would then just be Arrays of revised data, and not new audio objects per se.

You could put the attributes of a onto d, or you could apply the AudioTools:-Create command to d to set its audio attributes. You may need to think about what values to use.

restart;

kernelopts(version);

`Maple 2017.3, X86 64 LINUX, Sep 27 2017, Build ID 1265877`

with(AudioTools):
with(Statistics):

a:=Read(cat(kernelopts(datadir),"/audio/ding.wav"));

a := Vector(4, {(1) = ` 1 .. 20191 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

b:=ToMono(a): #changing to Mono.
c:=b^2: #squaring the signal.

d:=MovingAverage(c,30):

attributes(a);

22050, 16, 1

attributes(d); #NULL

setattribute(d,attributes(a)):
attributes(d);

22050, 16, 1

Preview(d);

dd:=Create(d,rate=22050);
attributes(dd);

dd := Vector(4, {(1) = ` 1 .. 20162 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

22050, 16, 1

Preview(dd);

 


audio_prev.mw

Computations are performed on the local computer than is running Maple.

(There are some very uncommon and specials ways to communicate with other machines/servers, but it has to be done purposefully and many people would not even know how. So, to a practical extent: all computations executed in your standard Maple program will be computed locally.)

As for indications of progess, well that depends very much on what kind of computation. And you've told us nothing about the particulars.

Is it a computation done by a procedure (not just a document) written by you? If so then you can inject periodic messaging code into it, in several different ways.

For quite a few Maple stock commands you can also adjust the infolevel setting, to get some progress notes. Note that the extent of such detail varies quite a bit, from command to command.

There are also ways to get Maple to plaster your screen with almost all that its doing at the interpreted Library code level. But this is usually so overwhelming that its not helpful.

 

This can be controlled manually using the the Typesetting:-RuleAssistant popup, or programmatically using the Typesetting:-Settings command.

This setting is not saved as part of the Worksheet/Document, nor can it saved as a global preference.

But you can hide preliminary calls to commands Typesetting:-Settings in the Startup Code region of the sheet, and so get such settings to be specific to the particular sheet.

restart;

Typesetting:-Settings(useprime); # default

true

diff(f(x), x)

diff(f(x), x)

Typesetting:-Settings(useprime=false):

diff(f(x), x)

`#msup(mi("f"),mo("&apos;"))`

lprint(%);

`#msup(mi("f"),mo("&apos;"))`

kernelopts(version);

`Maple 2017.2, X86 64 LINUX, Jul 19 2017, Build ID 1247392`

 


Download primediffparsing.mw

First 186 187 188 189 190 191 192 Last Page 188 of 336