Robert Israel

6577 Reputation

21 Badges

18 years, 218 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

The animate command was changed in Maple 9.   For your application, I think you do need display(..., insequence = true) in Maple 8.

The following would work:

with(plots):
 r:=sin(3*t): 
 K:=30: for i from 1 to K do ti:=i*2*Pi/K:
 curve[i]:=polarplot(r(t), t=0..ti) od:
 C:=display(seq(curve[i],i=1..K), insequence=true):
 display(C, scaling=constrained,tickmarks=[0,0], thickness=3,insequence=true);

 

The animate command was changed in Maple 9.   For your application, I think you do need display(..., insequence = true) in Maple 8.

The following would work:

with(plots):
 r:=sin(3*t): 
 K:=30: for i from 1 to K do ti:=i*2*Pi/K:
 curve[i]:=polarplot(r(t), t=0..ti) od:
 C:=display(seq(curve[i],i=1..K), insequence=true):
 display(C, scaling=constrained,tickmarks=[0,0], thickness=3,insequence=true);

 

Your images here all look like Chinese error messages.  You might try clicking on the FileManager button and uploading the image to MaplePrimes, then inserting the link.  For example:

 

 

Your images here all look like Chinese error messages.  You might try clicking on the FileManager button and uploading the image to MaplePrimes, then inserting the link.  For example:

 

 

> J:= int(-f(t)*(t-x),t=0..x);

J := int(-f(t)*(t-x),t = 0 .. x)

> map(expand,J);

int(-f(t)*t+f(t)*x,t = 0 .. x)

> J1:= map(collect,%,f(t));

J1 := int((-t+x)*f(t),t = 0 .. x)

Now, how to get that -t+x to become x-t?  Use sort.

> sort(-t+x,x,descending);

x-t

And this will make all occurrences of -t+x become x-t.  So:

> J1;

int((x-t)*f(t),t = 0 .. x)

 

Well, it's almost right.  I'm not sure there's an easy way to get the f(t) before the x-t, except entering f(t)*(x-t) by hand before creating  J1.

 

 

> J:= int(-f(t)*(t-x),t=0..x);

J := int(-f(t)*(t-x),t = 0 .. x)

> map(expand,J);

int(-f(t)*t+f(t)*x,t = 0 .. x)

> J1:= map(collect,%,f(t));

J1 := int((-t+x)*f(t),t = 0 .. x)

Now, how to get that -t+x to become x-t?  Use sort.

> sort(-t+x,x,descending);

x-t

And this will make all occurrences of -t+x become x-t.  So:

> J1;

int((x-t)*f(t),t = 0 .. x)

 

Well, it's almost right.  I'm not sure there's an easy way to get the f(t) before the x-t, except entering f(t)*(x-t) by hand before creating  J1.

 

 

Solving a linear system A x = b with bounds such as 0 <= x[i] <= 1 puts you into the domain of Linear Programming.  The LPSolve command in the Optimization package will do this.  If you just want any solution, you can use an objective of 0; with other objectives, you can explore the solution set.

Solving a linear system A x = b with bounds such as 0 <= x[i] <= 1 puts you into the domain of Linear Programming.  The LPSolve command in the Optimization package will do this.  If you just want any solution, you can use an objective of 0; with other objectives, you can explore the solution set.

Actually, you don't need to split it up by hand: after conversion to piecewise Maple can evaluate this.

> ETa := value(convert(ETa,piecewise)) assuming Pna > 0;

Inta looks pretty hopeless as far as closed-form solutions are concerned, but it helps to transform this into an integral on a finite interval.

> Intb := PDEtools[dchange](Pm = 1/u - 1, Inta, u);

For example, on my computer

> evalf(eval(Intb,Pa=1));

took 0.140 seconds, while

> evalf(eval(Inta,Pa=1));

took 48.469 seconds.

So now your plot is produced very quickly.

> plot(eval(ETa, Pna = Pa - Intb), Pa = 0 .. 100);

Actually, you don't need to split it up by hand: after conversion to piecewise Maple can evaluate this.

> ETa := value(convert(ETa,piecewise)) assuming Pna > 0;

Inta looks pretty hopeless as far as closed-form solutions are concerned, but it helps to transform this into an integral on a finite interval.

> Intb := PDEtools[dchange](Pm = 1/u - 1, Inta, u);

For example, on my computer

> evalf(eval(Intb,Pa=1));

took 0.140 seconds, while

> evalf(eval(Inta,Pa=1));

took 48.469 seconds.

So now your plot is produced very quickly.

> plot(eval(ETa, Pna = Pa - Intb), Pa = 0 .. 100);

I'm less of a fan of startup files than I used to be.  The good thing about them is that you can put some useful commands there and forget about them.  The bad thing is that you do tend to forget about them.  Then you expect your code to run on somebody else's system, when it depends on those useful commands that you forgot about...

I might suggest that if you do make a startup file, you have it print something such as "Greetings from the startup file" to remind you of the fact that it exists and has done something.

I'm less of a fan of startup files than I used to be.  The good thing about them is that you can put some useful commands there and forget about them.  The bad thing is that you do tend to forget about them.  Then you expect your code to run on somebody else's system, when it depends on those useful commands that you forgot about...

I might suggest that if you do make a startup file, you have it print something such as "Greetings from the startup file" to remind you of the fact that it exists and has done something.

Interesting that you mention that in this particular thread, because Euler was the one behind that particular piece of magic: exp(s+I*t)=exp(s)*(cos(t)+I*sin(t)) and the whole theory of logarithms of complex numbers were pretty much his idea.

 

The result returned by a procedure is the result of the last statement it executes.

In your case the procedure curve returns the value of P because that's the last thing it calculates.  As a side effect it also assigns values to the global variables P_bar and P.  But of course those values will be overwritten the next time curve is called. 

The result returned by a procedure is the result of the last statement it executes.

In your case the procedure curve returns the value of P because that's the last thing it calculates.  As a side effect it also assigns values to the global variables P_bar and P.  But of course those values will be overwritten the next time curve is called. 

First 149 150 151 152 153 154 155 Last Page 151 of 187