Will

1781 Reputation

16 Badges

20 years, 300 days
Maplesoft
Developer
Waterloo, Ontario, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center

Will Spaetzel is a Software Architect in the Maple T.A. Team at Maplesoft.

He started at Maplesoft in May of 2004 for a 16 month internship while completing his Bachelor of Computer Science from the University of Western Ontario. During his final year at UWO, he continued on as moderator for MaplePrimes. He joined Maplesoft full-time in May 2006 and moved to the web team in Jan 2007. In December of 2010, Will moved to the Maple T.A. team. 

Will was born and grew up in Ontario, Canada. He maintains a personal blog, dabbles in photography builds web applications in his spare time.

MaplePrimes Activity


These are replies submitted by Will

I had a bit of a typo in the link, try it again, it should work for you now. ____ William Spaetzel Marketing Engineer, Maplesoft
What Operating system are you using? Are you running the lastest version of Maple 10? (Tools->Check For Updates) Can you post the worksheet that is causing Maple to crash? ____ William Spaetzel Marketing Engineer, Maplesoft
I'm glad that I was able to solve your problem. I like having people reply and say "thanks" for solving their problem. It lets me know that they don't need any more help. And it makes me feel good that I helped them out. I don't think that you should worry about cluttering the forums, please thank away. ____ William Spaetzel Marketing Engineer, Maplesoft
I'm glad that I was able to solve your problem. I like having people reply and say "thanks" for solving their problem. It lets me know that they don't need any more help. And it makes me feel good that I helped them out. I don't think that you should worry about cluttering the forums, please thank away. ____ William Spaetzel Marketing Engineer, Maplesoft
The new MaplePrimes does not have that feature. The site will continue to improve, and I'll look into adding that feature into the future.
To switch to 1-D, press the F5 key on your keyboard or click the "Text" button on the left hand side of the 2nd toolbar of Maple. ____ William Spaetzel Marketing Engineer, Maplesoft
To switch to 1-D, press the F5 key on your keyboard or click the "Text" button on the left hand side of the 2nd toolbar of Maple. ____ William Spaetzel Marketing Engineer, Maplesoft

Here is a function that will do the plotting for you, all you have to do is pass the expression that you want plotted and the range, just like you do for plot. Copy and paste this code into your worksheet and you will be able to use the function anywere in your worksheet. Click here to download the worksheet to try it on your computer

When viewing the Worksheet below, the Pi symbols appear as "p". When you download the worksheet it will look better

Maple Equation

> trigPlot := proc( thePlot, range )
local start, finish, offset, spacing, truestart, ticks,tick, tickName, pos;
spacing := Pi/2;
start := op(1, op(2,range) );
finish := op(2, op(2,range ) );

ticks := [];
pos := start;
while( evalf(pos) <= evalf(finish) ) do

tickName := convert( pos, string );
tickName := StringTools[Substitute]( tickName, "Pi", "p" );
ticks := [op(ticks), evalf(pos)=tickName];
pos := pos + spacing;
end do:

plot( thePlot, range, axesfont= [SYMBOL],tickmarks = [ticks,default] );
end proc:

Here are some examples of its usage

> trigPlot(cos(x), x=-Pi..Pi);

Maple Plot

> trigPlot(sin(x),x=-2*Pi..Pi/2);

Maple Plot

> trigPlot(sin(x)^2, x=0..2*Pi);

Maple Plot

>

Maple Equation

This post was generated using the MaplePrimes File Manager
Download the original worksheet | View worksheet on MapleNet

Here is your code again:

> restart;

>

> numsol:=proc(eta,tau,lambda,beta,gamma0,cA,cB,VVAA,VVBB)

> local lambda_H, lambda_L, yAH, yAL, yBL, yBH, psi, g, Sigma, focA, focB, focvA, focvB, sys:

> global vA,vB,lAH,lBL,lAL,lBH:

> lambda_H:=1+lambda+beta*(1-eta):

> lambda_L:=1+lambda+beta*eta:

> yAH:=1+(lambda_H-1)*tau:

> yAL:=1-tau:

> yBL:=1+(lambda_L-1)*tau:

> yBH:=1-tau:

> lBH:=(eta-vA*lAH)/vB:

> lAL:=(1-eta-vB*lBL)/vA:

> psi:=x->1-exp(-x):

> g:=x->(1+x)*exp(-x):

> Sigma:=(1-psi(lAH))*(1-psi(lAL))*yAL-(1-psi(lBL))*(1-psi(lBH))*yBH:

> focA:=(1-psi(lAH))*(yAH-yAL)+Sigma-gamma0/eta*(3*vA*lAH-eta*(1+vA/(vA+vB)))=0:

> focB:=(1-psi(lBL)*(yBL-yBH)-Sigma-gamma0/(1-eta)*(3*vB*lBL-(1-eta)*(1+vB/(vA+vB))))=0:

> focvA:=yAH-g(lAH)*(yAH-yAL)-g(lAH+lAL)*yAL+gamma0*vA*lAH^2/eta+gamma0*vA*lAL^2/(1-eta)-cA=0:

> focvB:=yBL-g(lBH)*(yBL-yBH)-g(lBL+lBH)*yBH+gamma0*vB*lBL^2/(1-eta)+gamma0*vB*lBH^2/(1-eta)-cB=0:

> sys:={focA,focB,focvA,focvB}:

> fsolve(sys,{vA,vB,lAH,lBL},{vA=0..VVAA,vB=0..VVBB,lAH=0..2,lBL=0..2});

> end proc:

> lAHstar:=(eta,tau,gamma0)->subs(numsol(eta,tau,.1,.1,gamma0,.25,.25,20,20),lAH);

> lBLstar:=(eta,tau,gamma0)->subs(numsol(eta,tau,.1,.1,gamma0,.25,.25,20,20),lBL);

> vAstar:=(eta,tau,gamma0)->subs(numsol(eta,tau,.1,.1,gamma0,.25,.25,20,20),vA);

> vBstar:=(eta,tau,gamma0)->subs(numsol(eta,tau,.1,.1,gamma0,.25,.25,20,20),vB);

>

Maple Equation

Maple Equation

Maple Equation

Maple Equation

>

>

In order to be able to plot your function, you need to be able to give it a set of numeric values and have it return a number.

> lAHstar(1,2,3);

Error, (in numsol) numeric exception: division by zero

> lBLstar(5,6,3);

Error, (in lBLstar) invalid input: subs received fsolve({4.2*exp(-lAH)-5*exp(-lAH)*exp(-(-4-vB*lBL)/vA)+5*exp(-lBL)*exp(-(5-vA*lAH)/vB)-9/5*vA*lAH+3+3*vA/(vA+vB) = 0, -5.6+9.6*exp(-lBL)+5*exp(-lAH)*exp(-(-4-vB*lBL)/vA)-5*exp(-lBL)*exp(-(5-vA*lAH)/vB)+9/4*vB*lBL+3*vB/(vA+vB) = 0, -1.05-4.2*(1+lAH)*exp(-lAH)+5*(1+lAH+(-4-vB*lBL)/vA)*exp(-lAH-(-4-vB*lBL)/vA)+3/5*vA*lAH^2-3/4*(-4-vB*lBL)^2/vA = 0, 4.35-9.6*(1+(5-vA*lAH)/vB)*exp(-(5-vA*lAH)/vB)+5*(1+lBL+(5-vA*lAH)/vB)*exp(-lBL-(5-vA*lAH)/vB)-3/4*vB*lBL^2-3/4*(5-vA*lAH)^2/vB = 0}, {vA, vB, lAH, lBL}, {lAH = 0 .. 2, lBL = 0 .. 2, vA = 0 .. 20, vB = 0 .. 20}), which is not valid for its 1st argument

> vAstar(53,4,32);

Error, (in vAstar) invalid input: subs received fsolve({-19.65+16.4*(1+lAH)*exp(-lAH)+3*(1+lAH+(-52-vB*lBL)/vA)*exp(-lAH-(-52-vB*lBL)/vA)+32/53*vA*lAH^2-8/13*(-52-vB*lBL)^2/vA = 0, -16.4*exp(-lAH)-3*exp(-lAH)*exp(-(-52-vB*lBL)/vA)+3*exp(-lBL)*exp(-(53-vA*lAH)/vB)-96/53*vA*lAH+32+32*vA/(vA+vB) = 0, 7.4+25.6*exp(-lBL)+3*exp(-lAH)*exp(-(-52-vB*lBL)/vA)-3*exp(-lBL)*exp(-(53-vA*lAH)/vB)+24/13*vB*lBL+32*vB/(vA+vB) = 0, 22.35-25.6*(1+(53-vA*lAH)/vB)*exp(-(53-vA*lAH)/vB)+3*(1+lBL+(53-vA*lAH)/vB)*exp(-lBL-(53-vA*lAH)/vB)-8/13*vB*lBL^2-8/13*(53-vA*lAH)^2/vB = 0}, {vA, vB, lAH, lBL}, {lAH = 0 .. 2, lBL = 0 .. 2, vA = 0 .. 20, vB = 0 .. 20}), which is not valid for its 1st argument

> vBstar(6,3,46);

Error, (in vBstar) invalid input: subs received fsolve({1.8*exp(-lAH)-2*exp(-lAH)*exp(-(-5-vB*lBL)/vA)+2*exp(-lBL)*exp(-(6-vA*lAH)/vB)-23*vA*lAH+46+46*vA/(vA+vB) = 0, 41.9+5.1*exp(-lBL)+2*exp(-lAH)*exp(-(-5-vB*lBL)/vA)-2*exp(-lBL)*exp(-(6-vA*lAH)/vB)+138/5*vB*lBL+46*vB/(vA+vB) = 0, -.45-1.8*(1+lAH)*exp(-lAH)+2*(1+lAH+(-5-vB*lBL)/vA)*exp(-lAH-(-5-vB*lBL)/vA)+23/3*vA*lAH^2-46/5*(-5-vB*lBL)^2/vA = 0, 2.85-5.1*(1+(6-vA*lAH)/vB)*exp(-(6-vA*lAH)/vB)+2*(1+lBL+(6-vA*lAH)/vB)*exp(-lBL-(6-vA*lAH)/vB)-46/5*vB*lBL^2-46/5*(6-vA*lAH)^2/vB = 0}, {vA, vB, lAH, lBL}, {lAH = 0 .. 2, lBL = 0 .. 2, vA = 0 .. 20, vB = 0 .. 20}), which is not valid for its 1st argument

Each of your functions currently gives an error. Maybe I don't know the range of values that are valid. Can you please post examples where the functions give a good value? Or post valid ranges for the variables.

This post was generated using the MaplePrimes File Manager
Download the original worksheet | View worksheet on MapleNet

Here is your code again:

> restart;

>

> numsol:=proc(eta,tau,lambda,beta,gamma0,cA,cB,VVAA,VVBB)

> local lambda_H, lambda_L, yAH, yAL, yBL, yBH, psi, g, Sigma, focA, focB, focvA, focvB, sys:

> global vA,vB,lAH,lBL,lAL,lBH:

> lambda_H:=1+lambda+beta*(1-eta):

> lambda_L:=1+lambda+beta*eta:

> yAH:=1+(lambda_H-1)*tau:

> yAL:=1-tau:

> yBL:=1+(lambda_L-1)*tau:

> yBH:=1-tau:

> lBH:=(eta-vA*lAH)/vB:

> lAL:=(1-eta-vB*lBL)/vA:

> psi:=x->1-exp(-x):

> g:=x->(1+x)*exp(-x):

> Sigma:=(1-psi(lAH))*(1-psi(lAL))*yAL-(1-psi(lBL))*(1-psi(lBH))*yBH:

> focA:=(1-psi(lAH))*(yAH-yAL)+Sigma-gamma0/eta*(3*vA*lAH-eta*(1+vA/(vA+vB)))=0:

> focB:=(1-psi(lBL)*(yBL-yBH)-Sigma-gamma0/(1-eta)*(3*vB*lBL-(1-eta)*(1+vB/(vA+vB))))=0:

> focvA:=yAH-g(lAH)*(yAH-yAL)-g(lAH+lAL)*yAL+gamma0*vA*lAH^2/eta+gamma0*vA*lAL^2/(1-eta)-cA=0:

> focvB:=yBL-g(lBH)*(yBL-yBH)-g(lBL+lBH)*yBH+gamma0*vB*lBL^2/(1-eta)+gamma0*vB*lBH^2/(1-eta)-cB=0:

> sys:={focA,focB,focvA,focvB}:

> fsolve(sys,{vA,vB,lAH,lBL},{vA=0..VVAA,vB=0..VVBB,lAH=0..2,lBL=0..2});

> end proc:

> lAHstar:=(eta,tau,gamma0)->subs(numsol(eta,tau,.1,.1,gamma0,.25,.25,20,20),lAH);

> lBLstar:=(eta,tau,gamma0)->subs(numsol(eta,tau,.1,.1,gamma0,.25,.25,20,20),lBL);

> vAstar:=(eta,tau,gamma0)->subs(numsol(eta,tau,.1,.1,gamma0,.25,.25,20,20),vA);

> vBstar:=(eta,tau,gamma0)->subs(numsol(eta,tau,.1,.1,gamma0,.25,.25,20,20),vB);

>

Maple Equation

Maple Equation

Maple Equation

Maple Equation

>

>

In order to be able to plot your function, you need to be able to give it a set of numeric values and have it return a number.

> lAHstar(1,2,3);

Error, (in numsol) numeric exception: division by zero

> lBLstar(5,6,3);

Error, (in lBLstar) invalid input: subs received fsolve({4.2*exp(-lAH)-5*exp(-lAH)*exp(-(-4-vB*lBL)/vA)+5*exp(-lBL)*exp(-(5-vA*lAH)/vB)-9/5*vA*lAH+3+3*vA/(vA+vB) = 0, -5.6+9.6*exp(-lBL)+5*exp(-lAH)*exp(-(-4-vB*lBL)/vA)-5*exp(-lBL)*exp(-(5-vA*lAH)/vB)+9/4*vB*lBL+3*vB/(vA+vB) = 0, -1.05-4.2*(1+lAH)*exp(-lAH)+5*(1+lAH+(-4-vB*lBL)/vA)*exp(-lAH-(-4-vB*lBL)/vA)+3/5*vA*lAH^2-3/4*(-4-vB*lBL)^2/vA = 0, 4.35-9.6*(1+(5-vA*lAH)/vB)*exp(-(5-vA*lAH)/vB)+5*(1+lBL+(5-vA*lAH)/vB)*exp(-lBL-(5-vA*lAH)/vB)-3/4*vB*lBL^2-3/4*(5-vA*lAH)^2/vB = 0}, {vA, vB, lAH, lBL}, {lAH = 0 .. 2, lBL = 0 .. 2, vA = 0 .. 20, vB = 0 .. 20}), which is not valid for its 1st argument

> vAstar(53,4,32);

Error, (in vAstar) invalid input: subs received fsolve({-19.65+16.4*(1+lAH)*exp(-lAH)+3*(1+lAH+(-52-vB*lBL)/vA)*exp(-lAH-(-52-vB*lBL)/vA)+32/53*vA*lAH^2-8/13*(-52-vB*lBL)^2/vA = 0, -16.4*exp(-lAH)-3*exp(-lAH)*exp(-(-52-vB*lBL)/vA)+3*exp(-lBL)*exp(-(53-vA*lAH)/vB)-96/53*vA*lAH+32+32*vA/(vA+vB) = 0, 7.4+25.6*exp(-lBL)+3*exp(-lAH)*exp(-(-52-vB*lBL)/vA)-3*exp(-lBL)*exp(-(53-vA*lAH)/vB)+24/13*vB*lBL+32*vB/(vA+vB) = 0, 22.35-25.6*(1+(53-vA*lAH)/vB)*exp(-(53-vA*lAH)/vB)+3*(1+lBL+(53-vA*lAH)/vB)*exp(-lBL-(53-vA*lAH)/vB)-8/13*vB*lBL^2-8/13*(53-vA*lAH)^2/vB = 0}, {vA, vB, lAH, lBL}, {lAH = 0 .. 2, lBL = 0 .. 2, vA = 0 .. 20, vB = 0 .. 20}), which is not valid for its 1st argument

> vBstar(6,3,46);

Error, (in vBstar) invalid input: subs received fsolve({1.8*exp(-lAH)-2*exp(-lAH)*exp(-(-5-vB*lBL)/vA)+2*exp(-lBL)*exp(-(6-vA*lAH)/vB)-23*vA*lAH+46+46*vA/(vA+vB) = 0, 41.9+5.1*exp(-lBL)+2*exp(-lAH)*exp(-(-5-vB*lBL)/vA)-2*exp(-lBL)*exp(-(6-vA*lAH)/vB)+138/5*vB*lBL+46*vB/(vA+vB) = 0, -.45-1.8*(1+lAH)*exp(-lAH)+2*(1+lAH+(-5-vB*lBL)/vA)*exp(-lAH-(-5-vB*lBL)/vA)+23/3*vA*lAH^2-46/5*(-5-vB*lBL)^2/vA = 0, 2.85-5.1*(1+(6-vA*lAH)/vB)*exp(-(6-vA*lAH)/vB)+2*(1+lBL+(6-vA*lAH)/vB)*exp(-lBL-(6-vA*lAH)/vB)-46/5*vB*lBL^2-46/5*(6-vA*lAH)^2/vB = 0}, {vA, vB, lAH, lBL}, {lAH = 0 .. 2, lBL = 0 .. 2, vA = 0 .. 20, vB = 0 .. 20}), which is not valid for its 1st argument

Each of your functions currently gives an error. Maybe I don't know the range of values that are valid. Can you please post examples where the functions give a good value? Or post valid ranges for the variables.

This post was generated using the MaplePrimes File Manager
Download the original worksheet | View worksheet on MapleNet

What is it that you are looking for? Because when I enter both of your questions into Maple, I do get a good response.

> solve(y(x)+3*int((s+t)*y(t), t = 0 .. 1) = x^2+1, x);

Maple Equation

> solve(y(x)+3*int((s+t)*y(t), t = 0 .. 1) = x^2+1, s);

Maple Equation

>

Maple Equation

This post was generated using the MaplePrimes File Manager
Download the original worksheet | View worksheet on MapleNet

I just made a change that should fix your problem. Could you please try the same thing again and let me know if you have any more problems. ____ William Spaetzel Marketing Engineer, Maplesoft
Actually, the site is still in Beta, and will be for a few more weeks. We will be uploading a brand new redisgn of the site withn a week or two that includes a new logo, as a taste of what is to come, here is a screenshot of the new design Thanks for the feedback ____ William Spaetzel Marketing Engineer, Maplesoft

Sorry about not answering your actual question. I passed your problem on to the Math group here and this is what I got back:

> restart; with(student):> f:= x->x; #anything, just so long as f is a function.> b:= leftsum( f, x=1..2, 6);

Maple Equation
Maple Equation

"Too many levels of recursion" is not a trappable error. However, the problem in this case is that the question is malformed. If you examine the original assignment to c, you have:

> c:= evalf(b);

Maple Equation

c;
Error, too many levels of recursion

That "r" is an escaped local, and whatever it is assigned is not happy when evaluating:

> op(1,eval(c,1));

Maple Equation

op(2,eval(%,1));

Maple Equation

%;
Error, too many levels of recursion

The root cause is the passing if a function (rather than an expression) to the leftsum command. If "f" is rerplaced by f(x) (or even 'f'(x)) then the calculation works fine:

> b:= leftsum( 'f'(x), x=1..2, 6);

Maple Equation

c:= evalf(b);

Maple Equation

Maple Equation

This post generated using the online HTML conversion tool
Download the original worksheet View worksheet on MapleNET

It looks like the tickmarks option does not have an effect on the loglogplot. However, by using plots[display], you can get around this. As you can see below.

> with(plots): a:= loglogplot(exp(10^x), x = 1 .. 20):

display(a,tickmarks=[0,0]);

Maple Plot

Maple Equation

This post generated using the online HTML conversion tool
Download the original worksheet View worksheet on MapleNET

First 33 34 35 36 37 38 39 Last Page 35 of 48