Robert Israel

6577 Reputation

21 Badges

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

MaplePrimes Activity


These are replies submitted by Robert Israel

Sorry, I didn't notice the part of your question involving parameter k.  Suppose the system is

> sys:= {diff(x(t),t) = k*y(t) + x(t)*y(t), diff(y(t),t) = y(t) - x(t), 
      x(0) = 1, y(0) = 0};
  Sol:= dsolve(sys, numeric, output=listprocedure,parameters=[k]);
  X:= subs(Sol, x(t));
  Y:= subs(Sol, y(t)); 

Now you'd like functions of two variables t and k. 

   X2:= proc(t, k) X(parameters=[k]); X(t); end proc;
   Y2:= proc(t, k) Y(parameters=[k]); Y(t); end proc;
   Xp:= unapply(subs(sys,x(t)='X2(t,k)',y(t)='Y2(t,k)',diff(x(t),t)),t,k);

These can't be applied to symbolic t and k, but they're ok with numeric t and k, and you can plot them in 3d, e.g.:
         

> plot3d(Xp, 0 .. 5, 0 .. 3, axes=box, labels = [t, k, diff(x(t),t)]);

Sorry, I didn't notice the part of your question involving parameter k.  Suppose the system is

> sys:= {diff(x(t),t) = k*y(t) + x(t)*y(t), diff(y(t),t) = y(t) - x(t), 
      x(0) = 1, y(0) = 0};
  Sol:= dsolve(sys, numeric, output=listprocedure,parameters=[k]);
  X:= subs(Sol, x(t));
  Y:= subs(Sol, y(t)); 

Now you'd like functions of two variables t and k. 

   X2:= proc(t, k) X(parameters=[k]); X(t); end proc;
   Y2:= proc(t, k) Y(parameters=[k]); Y(t); end proc;
   Xp:= unapply(subs(sys,x(t)='X2(t,k)',y(t)='Y2(t,k)',diff(x(t),t)),t,k);

These can't be applied to symbolic t and k, but they're ok with numeric t and k, and you can plot them in 3d, e.g.:
         

> plot3d(Xp, 0 .. 5, 0 .. 3, axes=box, labels = [t, k, diff(x(t),t)]);

Georgios's code doesn't work because zip needs its two arguments to be of the same type.  It would work if xdata was also an Array.  Thus:

> xdata:= Array([$1..25]);

But a simpler one-line solution (assuming your f returns numeric values) is

> plot([seq]([i,f(i)],i=1..25), style=point);

or if you really need to use the Array A:

> plots[listplot](A, style=point);

Georgios's code doesn't work because zip needs its two arguments to be of the same type.  It would work if xdata was also an Array.  Thus:

> xdata:= Array([$1..25]);

But a simpler one-line solution (assuming your f returns numeric values) is

> plot([seq]([i,f(i)],i=1..25), style=point);

or if you really need to use the Array A:

> plots[listplot](A, style=point);

A better way:

> plottools[transform]((x,y,z) -> [x,x+y+z])
   (plots[intersectplot](-3*x1+4*x1^3-3*x2+4*x2^3-3*x3+4*x3^3,
           5*x1-20*x1^3+16*x1^5+5*x2-20*x2^3+16*x2^5+5*x3-20*x3^3+16*x3^5,
    x1=0..1, x2=0..1, x3=0..1));

A better way:

> plottools[transform]((x,y,z) -> [x,x+y+z])
   (plots[intersectplot](-3*x1+4*x1^3-3*x2+4*x2^3-3*x3+4*x3^3,
           5*x1-20*x1^3+16*x1^5+5*x2-20*x2^3+16*x2^5+5*x3-20*x3^3+16*x3^5,
    x1=0..1, x2=0..1, x3=0..1));

For a square Matrix with float or complex float entries and shape=hermitian, it seems to me that the eigenvalues are always in increasing order.  You do need to make the shape hermitian (or symmetric in the real case), not just have the entries satisfying M[i,j] = conjugate(M[j,i]), so that Maple knows it should use an algorithm for hermitian matrices.

Classic should be available in Maple 13 under 32-bit Windows and Linux, but not in 64-bit Windows or on a Mac.   However, I believe you can still have command-line Maple on those systems, and that should produce the same PostScript as Classic does.

 

Classic should be available in Maple 13 under 32-bit Windows and Linux, but not in 64-bit Windows or on a Mac.   However, I believe you can still have command-line Maple on those systems, and that should produce the same PostScript as Classic does.

 

Please upload a Maple worksheet, rather than an image.  Especially with 2D Maple input, it's hard to check visually for mistakes because something can look right but be syntactically wrong.  But one thing I see is that you seem to have the equation k = 2*Pi/lambda rather than an assignment k := 2*Pi/lambda.  The result will be that u(r, theta, z) will have the symbolic variable k in it, and of course there will be no numerical values to plot.

As I suggested, you should check that u(r, theta, z) gives you numerical values when given numbers for r, theta and z. 

Please upload a Maple worksheet, rather than an image.  Especially with 2D Maple input, it's hard to check visually for mistakes because something can look right but be syntactically wrong.  But one thing I see is that you seem to have the equation k = 2*Pi/lambda rather than an assignment k := 2*Pi/lambda.  The result will be that u(r, theta, z) will have the symbolic variable k in it, and of course there will be no numerical values to plot.

As I suggested, you should check that u(r, theta, z) gives you numerical values when given numbers for r, theta and z. 

Using the Classic interface, it works for me.  At 883 KB the file is a bit too big to upload here, but here's a link to it on my web site:
  www.math.ubc.ca/~israel/myplot.eps

 

Using the Classic interface, it works for me.  At 883 KB the file is a bit too big to upload here, but here's a link to it on my web site:
  www.math.ubc.ca/~israel/myplot.eps

 

It doesn't crash for me, it just doesn't return a value.  The main problem here is that If R and V are Vectors, R . V will use the complex conjugate of R.  In your case this shouldn't make a difference, because you want t > 2, but Maple doesn't know that when it computes r(t) . v(t).  One way to avoid that is to use the transpose of the first vector, so that "." will be just ordinary vector multiplication: thus r(t)^%T . v(t).

> solve({r(t)^%T . v(t), t > 2, t <= 27}, t);

{t = 13.58622459}, {t = 17.71237270}

It doesn't crash for me, it just doesn't return a value.  The main problem here is that If R and V are Vectors, R . V will use the complex conjugate of R.  In your case this shouldn't make a difference, because you want t > 2, but Maple doesn't know that when it computes r(t) . v(t).  One way to avoid that is to use the transpose of the first vector, so that "." will be just ordinary vector multiplication: thus r(t)^%T . v(t).

> solve({r(t)^%T . v(t), t > 2, t <= 27}, t);

{t = 13.58622459}, {t = 17.71237270}

First 41 42 43 44 45 46 47 Last Page 43 of 187