PatrickT

Dr. Patrick T

2088 Reputation

18 Badges

14 years, 86 days

MaplePrimes Activity


These are replies submitted by PatrickT

I've only looked at this very briefly as I couldn't quite understand the question, but for whatever it's worth: 


ode1:=diff(f(eta),eta$3)+f(eta)*diff(f(eta),eta$2)-diff(f(eta),eta$1)^2-M^2*diff(f(eta),eta$1)+M^2*b+b^2=0:
ode2:=diff(g(eta),eta$3)+f(eta)*diff(g(eta),eta$2)+(Lambda-2*diff(f(eta),eta$1)-M^2)*diff(g(eta),eta$1)+diff(f(eta),eta$2)*g(eta)=0:
odesys := [ode1,ode2]:
bc := [ f(0) = 0, D(f)(0) = 1, D(f)(N) = b, g(0) = 0, D(g)(0) = 0, D(g)(N) = 0 ];
sys := [op(odesys),op(bc)];
values := [N=10,M=0.1];
params := [b,Lambda];
eval(sys,values);
sysf := eval(eval(sys,values),[b=1,Lambda=1]);
dsolve(sysf,'numeric');

[ seq( dsolve(eval(sys,values),'numeric','output'=listprocedure), params = [b=1,Lambda=1] ) ];
Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 8, got 6 

 

 


 

 

I would love to see the Maple-equivalent of the free Mathematica interactive player,

http://www.wolfram.com/products/player/

Short of that, I would be thrilled if it were possible to create standalone worksheets that anyone could read and with a minimal amount of interactivity. I have in mind the ability to: rotate a 3D plot with the mouse and the ability to manipulate sliders (say). For instance, the amazing Fractal implementations of acer, available here:

http://www.mapleprimes.com/posts/134419-Faster-Fractals

And in particular, the latest version with Julia sets and Mandelbrot sets: 

http://www.mapleprimes.com/view.aspx?sf=141040/449205/fastJuliabreakpoint.mw

If I could email a standalone version of the fastJuliabreakpoint animations, even if limited in its ability to be interactively manipulated (e.g. sliders could be moved but new data could not be typed into the text-area), that would be fantastic. 

I think Maple would benefit from reaching out to non-Maple users.

The only time I managed to get Mathematica users interested in Maple was when Maple came bundled with Matlab. I think Maple needs to reach out.

 

I can't help you I'm afraid, but I can say this: your formula for Hn (for even values) matches that in wikipedia And Maple is able to find the alternative representation in terms of Laguerre polynomials. That's all I can say, don't know anything about this topic.

In 1D input the ! would be replaced by Factorial(), I believe. 


Hn := (n,x) -> Factorial(n)*SUM(((-1)^(n/2-l))/(Factorial(2*l)*Factorial(n/2-l))*((2*x)^(2*l)),l=0..n/2):
     Hn(n,x);

G := (x,z) -> SUM(Hn(2*n,x)/Factorial(2*n)*z^(2*n),n=0..infinity);
   G(x,z);  ### Even values, note: 2*n

# just checking if using sum or SumTools:-Summation makes any difference, it doesn't.

eval(G(x,z),SUM=sum);

eval(G(x,z),SUM=SumTools:-Summation);

 

 

sum((1/2)*(-1)^n*Pi^(1/2)*(2*LaguerreL(n, 1/2, x^2)*x^2+LaguerreL(n, 1/2, x^2)-2*x^2*LaguerreL(n, 3/2, x^2))*z^(2*n)/GAMMA(n+3/2), n = 0 .. infinity) 

Plots have been recently fixed, improved, damaged (as the case may be), but they remain, to me, the most frustrating aspect of the Maple experience. 

One area that requires drastic improvement is PROGRAMMATIC* export capabilities: this has received attention, with postscript export for 3d plots fully redesigned, but more needs to be done: the bugs need to be fixed (there are dozens of bugs, described elsewhere, see references to my comment higher up this thread). It is my one most pressing wish for future versions of Maple. 

Beyond fixing the bugs in the plot export tools, I would very much like to see an improvement in the flexibility of the elements of a plot, that is options that make it easy for the user to PROGRAMMATICALLY*  control things like: position of captions, legends, labels, axes, etc. not just left/right or top/bottom, but the ability to tell the plot command exactly where you want the elements to appear (in addition to the useful left/right and top/bottom options). As of Maple 16, some of these things can be controlled, but not nearly as many as I would like.

I'd like it to be easy to modify axes programmatically, I'm thinking of the ability to take a plot and change it to a logplot by a simple command or change its orientation or stretch the horizontal axis, etc. in a more efficient and convenient way than the current plottools tools.

I'd like it to be easy to PROGRAMMATICALLY* take an existing plot and delete data from it, remove a title, add a background, etc. without "breaking" it.

I'd like it to be a lot easier than it is to get a properly formatted legend, with trailing zeros stripped if so-wished, with values converted to floats, to rationals, etc. as specified by the user, and with, of course, a tex-based interpreter, so one can write things like '$\int_{0}^{\infty}f(x)dx$=evalf(ff)' in the legend, and all of this PROGRAMMATICALLY* and with lots of examples in the help pages to go by. (there exist roundabout method to get good-looking legends but they usually involve writing special procedures and asking acer for help at some stage) 

I'd like to have the ability to tell the plot command whether axes should be written on top or allowed to be overwritten by plotted objects. I'd like to have the ability to add a background image and/or color to the plot, with the ability to add a background inside/outside the plotting area delimited by the axes. The ability to change the color of the plot labels and other elements, to select shades, to darken or thicken with a simple command, to control font sizes separately for different elements.

I'd like a much greater choice of symbols to use in plots, beyond "dash", "dashdot", "dot", "longdash", "solid", "spacedash", "spacedot", "ticks". I'd like (I think acer suggested that once) to be able to select an image and use it as a symbol. I'd like to have all sorts of geometric shaps, like hearts, ovals, clubs, etc. as well as currency symbols, e.g. to plot dollar- and yen- denominated values. And also the ability to construct a symbol myself and use that, say with plottools (I know how to modify a postscript file to change the symbols inside, but I'd wish for something that any user could do). I'd like to see more 3D symbols too.

I'd like smartplot not to overwrite user-specified 'view' and such and to act only when called upon and not by default, e.g. plot(, 'option' =smartplot). 

I'd like the plot command to treat piecewise functions with discont=true and not connect points that are clearly discontinuous.  

I'd like to be able to write 'numpoints' = [50, 1000] just like you can write 'color' = [red,blue]. As of now you either have to set 'numpoints'=1000 (which computes points not needed for the first plot) or create the two plots separately and display them together later (however, if the plots are created separately, using a legend is tricky)

I'd like to be able to project a 3D plot onto 2D.

EDIT [added as afterthoughts]:

I'd love to be able to export Array/Matrix plots as postscript or vector graphics.

I'd love to be able to create x3d plots (current implementation has never worked for me)

NOTE:  These are just off the top of my head. I must be forgetting important things.  Some of these wishes can already be implemented in a roundabout way. My wish is for these things to be easy to do and not limited to Maple experts.

*I don't care about mouse-based manipulations, I am after actions that can be repeated over and over.

@escorpsy 

Take a look at acer's post and references :

http://www.mapleprimes.com/posts/119858-Faster-Than-DEplot

@escorpsy 

Take a look at acer's post and references :

http://www.mapleprimes.com/posts/119858-Faster-Than-DEplot

surd helps in cases that are more general than those mentioned in the help pages (unless I misread the help pages):

eq := x = 11/500+6*u*(1/25)-u^2+(-174200000000*x^5+13045131*E^4*u^4)^(3/5)/(65225655*E^4*u^4);
eq := Surdify(eq);
seq( [ E, Optimization:-Maximize(
x
 , {eq}
 , u = 0 .. 1
) ]
, E = 0.01 .. 1, 0.01 ):
%[1..5];

Note: for this trickier example I did need to specify a range for u, otherwise it returns: Error, (in Optimization:-NLPSolve) no improved point could be found.

Note: in latin "ab" means "out of" or "from" hence the cheap and unfunny pun in the title of this comment.

surd helps in cases that are more general than those mentioned in the help pages (unless I misread the help pages):

eq := x = 11/500+6*u*(1/25)-u^2+(-174200000000*x^5+13045131*E^4*u^4)^(3/5)/(65225655*E^4*u^4);
eq := Surdify(eq);
seq( [ E, Optimization:-Maximize(
x
 , {eq}
 , u = 0 .. 1
) ]
, E = 0.01 .. 1, 0.01 ):
%[1..5];

Note: for this trickier example I did need to specify a range for u, otherwise it returns: Error, (in Optimization:-NLPSolve) no improved point could be found.

Note: in latin "ab" means "out of" or "from" hence the cheap and unfunny pun in the title of this comment.

of course acer, as always your suggestions save me. Thanks! 

The following worked instantly:

Surdify := proc(f)
subsindets(eval(f),`^`,convert,surd);
end proc :


eq := x = 11/500+6*u*(1/25)-u^2+(-174200000000*x^5+13045131*E^4*u^4)^(1/5)/(65225655*E^4*u^4);
eq := Surdify(eq):
seq( [ E, Optimization:-Maximize( x, {eq} ) ]
     , E = 0.01 .. 1, 0.01 ):
%[1..5];

Note that (in this example anyway) it works without having to specify a range for u and x, without having to declare them as variables, without an initial point, etc..

surd really has special powers, as it were.

of course acer, as always your suggestions save me. Thanks! 

The following worked instantly:

Surdify := proc(f)
subsindets(eval(f),`^`,convert,surd);
end proc :


eq := x = 11/500+6*u*(1/25)-u^2+(-174200000000*x^5+13045131*E^4*u^4)^(1/5)/(65225655*E^4*u^4);
eq := Surdify(eq):
seq( [ E, Optimization:-Maximize( x, {eq} ) ]
     , E = 0.01 .. 1, 0.01 ):
%[1..5];

Note that (in this example anyway) it works without having to specify a range for u and x, without having to declare them as variables, without an initial point, etc..

surd really has special powers, as it were.

I have not been able to solve the above example without "surd", even after setting initialpoint very close to the actual solution. I also tried without specifying a range for x or by specifying a narrow range for both u and x. I also wrapped the equation inside evalf. I also tried 'assume'=nonnegative and wrapping the equation with Re() to remove possible spurious imaginary bits. It loooks like a tough one to crack without "surd".

 

 

 

I have not been able to solve the above example without "surd", even after setting initialpoint very close to the actual solution. I also tried without specifying a range for x or by specifying a narrow range for both u and x. I also wrapped the equation inside evalf. I also tried 'assume'=nonnegative and wrapping the equation with Re() to remove possible spurious imaginary bits. It loooks like a tough one to crack without "surd".

 

 

 

 

Thanks acer, great!  

This helps tremendously and will enable me to move forward with this simulation. I can also see how this will be useful in other problems I will be looking at soon.

There are 3 distinct things in your post: 

  1. use eq as a constraint, rather than maximizing wrt the implicit solution
  2. initialize the problem with 'initialpoint'
  3. convert powers to the surd function

When stating the problem I described using eq as a constraint (point 1 above) but somehow got lost along the way trying to handle RootOf directly and missed it. On a better day I might have got there. After another day of searching through the help pages and the mapleprimes archive, I might (ought to) have been able to figure out 'initialpoint' (point 2 above). However, point 3 above would have stumped me, because without the conversion to 'surd', the Optimization fails. So converting powers to surd is a crucial step in solving the problem, it would appear.

restart; # acer's solution without surd fails
### original equation
eq := x = 11/500+6*u*(1/25)-u^2+(-174200000000*x^5+13045131*E^4*u^4)^(1/5)/(65225655*E^4*u^4):
E:=0.1:
Optimization:-Maximize(x,{eq},u=0..1,x=0..1,initialpoint=[x=1,u=0.5]);

Error, (in Optimization:-NLPSolve) complex value encountered 

A natural follow-up question, therefore, is: How can I convert the powers to surd? These equations are the result of prior computations, so I can't just "input" them with surd written in, I need to convert them.

The powers appear in the middle of the expression, rather than around it, so I need to instruct convert(expr,surd) to search inside the expression for instances of `^`. How?

convert(eq,surd); # FAILS
convert((-174200000000*x^5+13045131*E^4*u^4)^(1/5),surd); # WORKS when the power wraps
hastype(eq,`^`); # Maple can "see" the powers inside the expression

true

 

Also, what if the powers are rational, e.g. 3/5 instead of 1/5?

The help pages suggest surd takes an integer:

From ?surd
Calling Sequence
surd(x, n)
    x - any algebraic expression
    n - any algebraic expression, understood to be an integer

Example with a rational power: 

eq := x = 11/500+6*u*(1/25)-u^2+(-174200000000*x^5+13045131*E^4*u^4)^(3/5)/(65225655*E^4*u^4): 

If this is a mess, well never mind, I'll restrict my parameter values accordingly.

 

Last remark, on accessing the solutions. Previously, I was using things like op([1,1],sol), but you took a different approach, so I reverse-engineered your code and came up with this: 


### how I usually do this
xpts := [ seq( [ op([i,1],[sols]), op([i,2,1],[sols]) ], i = 1 .. nops([sols]) ) ];
upts := [ seq( [ op([i,1],[sols]), rhs(op([i,2,2,1],[sols])) ], i = 1 .. nops([sols]) ) ];

### alternative based on acer's code
xpts := [ seq( [ s[][1], s[][2,1] ], s in sols ) ];
upts := [ seq( [ s[][1], rhs(s[][2,2,1]) ], s in sols ) ];

The latter approach is clearly shorter and more elegant. Both approaches rely on the solution being ordered in a consistent way across sessions. To be "surer" that the ordering would be consistent I wrote 'initialpoint'=[u=0.5,x=1], so the u comes before the x, as it is with the arguments (u=0..1,x=0..1). 

 

Thanks acer, great!  

This helps tremendously and will enable me to move forward with this simulation. I can also see how this will be useful in other problems I will be looking at soon.

There are 3 distinct things in your post: 

  1. use eq as a constraint, rather than maximizing wrt the implicit solution
  2. initialize the problem with 'initialpoint'
  3. convert powers to the surd function

When stating the problem I described using eq as a constraint (point 1 above) but somehow got lost along the way trying to handle RootOf directly and missed it. On a better day I might have got there. After another day of searching through the help pages and the mapleprimes archive, I might (ought to) have been able to figure out 'initialpoint' (point 2 above). However, point 3 above would have stumped me, because without the conversion to 'surd', the Optimization fails. So converting powers to surd is a crucial step in solving the problem, it would appear.

restart; # acer's solution without surd fails
### original equation
eq := x = 11/500+6*u*(1/25)-u^2+(-174200000000*x^5+13045131*E^4*u^4)^(1/5)/(65225655*E^4*u^4):
E:=0.1:
Optimization:-Maximize(x,{eq},u=0..1,x=0..1,initialpoint=[x=1,u=0.5]);

Error, (in Optimization:-NLPSolve) complex value encountered 

A natural follow-up question, therefore, is: How can I convert the powers to surd? These equations are the result of prior computations, so I can't just "input" them with surd written in, I need to convert them.

The powers appear in the middle of the expression, rather than around it, so I need to instruct convert(expr,surd) to search inside the expression for instances of `^`. How?

convert(eq,surd); # FAILS
convert((-174200000000*x^5+13045131*E^4*u^4)^(1/5),surd); # WORKS when the power wraps
hastype(eq,`^`); # Maple can "see" the powers inside the expression

true

 

Also, what if the powers are rational, e.g. 3/5 instead of 1/5?

The help pages suggest surd takes an integer:

From ?surd
Calling Sequence
surd(x, n)
    x - any algebraic expression
    n - any algebraic expression, understood to be an integer

Example with a rational power: 

eq := x = 11/500+6*u*(1/25)-u^2+(-174200000000*x^5+13045131*E^4*u^4)^(3/5)/(65225655*E^4*u^4): 

If this is a mess, well never mind, I'll restrict my parameter values accordingly.

 

Last remark, on accessing the solutions. Previously, I was using things like op([1,1],sol), but you took a different approach, so I reverse-engineered your code and came up with this: 


### how I usually do this
xpts := [ seq( [ op([i,1],[sols]), op([i,2,1],[sols]) ], i = 1 .. nops([sols]) ) ];
upts := [ seq( [ op([i,1],[sols]), rhs(op([i,2,2,1],[sols])) ], i = 1 .. nops([sols]) ) ];

### alternative based on acer's code
xpts := [ seq( [ s[][1], s[][2,1] ], s in sols ) ];
upts := [ seq( [ s[][1], rhs(s[][2,2,1]) ], s in sols ) ];

The latter approach is clearly shorter and more elegant. Both approaches rely on the solution being ordered in a consistent way across sessions. To be "surer" that the ordering would be consistent I wrote 'initialpoint'=[u=0.5,x=1], so the u comes before the x, as it is with the arguments (u=0..1,x=0..1). 

wishes were also expressed here: 

http://www.mapleprimes.com/posts/126371-Maple-17-Wish-List

First 7 8 9 10 11 12 13 Last Page 9 of 93