Robert Israel

6577 Reputation

21 Badges

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

MaplePrimes Activity


These are replies submitted by Robert Israel

You can tell pds:-plot what function(s) you want to plot.  Thus:

> Uplot:= pds:-plot(u(x,t),t=10, numpoints=50, colour=red):
  Vplot:= pds:-plot(v(x,t), t=10, numpoints=50, colour=blue):
  plots[display]([Uplot, Vplot]);

will produce a plot of u(x,10) in red and v(x,10) in blue, for x from -10 to 10.

If you want a parametric plot of u(x,10) against v(x,10), I don't see how to do it directly in pds:-plot, but you can combine the data from Uplot and Vplot as follows:

> XU:= op([1,1], Uplot):
   XV := op([1,1], Vplot):
  UV:= Array([seq([XU[i,2],XV[i,2]],i=1..50)],datatype=float[8],order=C_order):
  PLOT(CURVES(UV),COLOUR(RGB,1,0,0),AXESLABELS("u","v"));
 

 

You can tell pds:-plot what function(s) you want to plot.  Thus:

> Uplot:= pds:-plot(u(x,t),t=10, numpoints=50, colour=red):
  Vplot:= pds:-plot(v(x,t), t=10, numpoints=50, colour=blue):
  plots[display]([Uplot, Vplot]);

will produce a plot of u(x,10) in red and v(x,10) in blue, for x from -10 to 10.

If you want a parametric plot of u(x,10) against v(x,10), I don't see how to do it directly in pds:-plot, but you can combine the data from Uplot and Vplot as follows:

> XU:= op([1,1], Uplot):
   XV := op([1,1], Vplot):
  UV:= Array([seq([XU[i,2],XV[i,2]],i=1..50)],datatype=float[8],order=C_order):
  PLOT(CURVES(UV),COLOUR(RGB,1,0,0),AXESLABELS("u","v"));
 

 

This is a correct and accurate solution, but not the only one.  The solution you got from LPSolve was

[x1 = 0., x2 = 0.99999999896740222, x11 = 0., x6 = 0.,   x7 = 0., x9 = 0.99999999896740222, x10 = 0., x8 = 0., x3 = 0.,   x4 = 1.03259778874000004 *10^(-9)  , x5 = 0.]

which rounds to

[x1 = 0, x2 = 1, x3 = 0, x4 = 0, x5 = 0, x6 = 0, x7 = 0, x8 = 0, x9 = 1, x10 = 0, x11 = 0]

which is also a correct solution.  You say "That floating answer is not correct at all", but it really is very close to correct: some of the constraints are violated by about 10^(-9).

 

it won't work for an expression containing some functions that can be converted and others that can't; the ones that can't should be left alone.  Thus (with alec's definition):

> fas(sin(x) + Si(x), cos);

cos form for Si(x) is unknown to the system
 

-cos(x+1/2*Pi)+(1, 2)

 

Normally xmaple (or maple -x) would give you the Standard interface, and maple -cw would be the command for Classic.  Of course, you could set up aliases in Unix to change that behaviour. 

Normally xmaple (or maple -x) would give you the Standard interface, and maple -cw would be the command for Classic.  Of course, you could set up aliases in Unix to change that behaviour. 

One limitation of fas as opposed to convert is that  the first argument to fas must be of type function (or symbol or string).  So  fas(2*sin(x), cos) causes an error.

Since LPSolve works with floats, roundoff error is to be expected.  In this case the problem itself does not involve floats and is quite small, so if you want an exact rational solution you can try the old simplex package.

> simplex[minimize](obj, cnsts, NONNEGATIVE);

{x1 = 1, x10 = 1, x11 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, x6 = 0, x7 = 0, x8 = 0, x9 = 0}

Not too surprisingly, this is the solution obtained by rounding the results of LPSolve, as Alec mentioned.  Of course there will be other cases where the optimal solution does not involve integers, so rounding may not be helpful.

A useful way to find out what conversions are possible from a given function is FunctionAdvisor(specialize, ...). For example:

> FunctionAdvisor(specialize, Ssi(x));

 [Ssi(x) = -1/2*I*(Ei(1,x*I)-Ei(1,-I*x))+1/2*(csgn(x)-1)*Pi, `with no restrictions on `(x)]

[Ssi(x) = 1/4*x*Pi^(1/2)*MeijerG([[1/2], []],[[0], [-1/2, -1/2]],1/4*x^2)-1/2*Pi, `with no restrictions on `(x)]

[Ssi(x) = 1/2*I*(2*Shi(-I*x)+Pi*I), `with no restrictions on `(x)]

[Ssi(x) = Si(x)-1/2*Pi, `with no restrictions on `(x)]

[Ssi(x) = x*hypergeom([1/2],[3/2, 3/2],-1/4*x^2)-1/2*Pi, `with no restrictions on `(x)]

A useful way to find out what conversions are possible from a given function is FunctionAdvisor(specialize, ...). For example:

> FunctionAdvisor(specialize, Ssi(x));

 [Ssi(x) = -1/2*I*(Ei(1,x*I)-Ei(1,-I*x))+1/2*(csgn(x)-1)*Pi, `with no restrictions on `(x)]

[Ssi(x) = 1/4*x*Pi^(1/2)*MeijerG([[1/2], []],[[0], [-1/2, -1/2]],1/4*x^2)-1/2*Pi, `with no restrictions on `(x)]

[Ssi(x) = 1/2*I*(2*Shi(-I*x)+Pi*I), `with no restrictions on `(x)]

[Ssi(x) = Si(x)-1/2*Pi, `with no restrictions on `(x)]

[Ssi(x) = x*hypergeom([1/2],[3/2, 3/2],-1/4*x^2)-1/2*Pi, `with no restrictions on `(x)]

First of all, dsolve(..., numeric) isn't using a fixed step size, so your question doesn't quite make sense.  The default method is a Runge-Kutta-Fehlberg method.  But let's suppose you specified, say, method=classical[foreuler] for the Euler method which does have a fixed step size.  Now the actual numerical calculation doesn't happen until you call p(1/2), so the end point t=1/2 is known.  The step size can either be specified explicitly or chosen by Maple: if the latter, the choice is made by the procedure p itself.  Anyway, if 1/2-a is not an integer multiple of the step size, the last step will be made smaller so that it ends up at t=1/2.

First of all, dsolve(..., numeric) isn't using a fixed step size, so your question doesn't quite make sense.  The default method is a Runge-Kutta-Fehlberg method.  But let's suppose you specified, say, method=classical[foreuler] for the Euler method which does have a fixed step size.  Now the actual numerical calculation doesn't happen until you call p(1/2), so the end point t=1/2 is known.  The step size can either be specified explicitly or chosen by Maple: if the latter, the choice is made by the procedure p itself.  Anyway, if 1/2-a is not an integer multiple of the step size, the last step will be made smaller so that it ends up at t=1/2.

See the help page ?convert,to_special_function (which is in turn referenced by ?convert.

See the help page ?convert,to_special_function (which is in turn referenced by ?convert.

Yes, it would be nice if that sort of information were provided on the help pages.  Unfortunately, the existing help pages don't have it, and it would be an awfully big project to edit help pages on all Maple functions to provide that information.

However, it ought to be possible to get that information in a search of the help database, if that system were better designed.  What you'd want would be a search for the words "Basis" and "Groebner" in help pages where the topic starts with "update".  It would be enough to be able to take the results of one search (e.g. for the topic "update") and then refine the search by looking for words.  Unfortunately the help system does not have the necessary functionality.

 

First 122 123 124 125 126 127 128 Last Page 124 of 187