PatrickT

Dr. Patrick T

2168 Reputation

18 Badges

17 years, 174 days

MaplePrimes Activity


These are replies submitted by PatrickT

thanks so much jakubi for your patient explanations!

Thanks David for your help. I hope Maple 14 will take care of those 3D plots!

It seems rather a shame to be able to do so much with Maple inline but not be able to export it as a beautiful print-ready object.

Patrick.

Thanks David for your help. I hope Maple 14 will take care of those 3D plots!

It seems rather a shame to be able to do so much with Maple inline but not be able to export it as a beautiful print-ready object.

Patrick.

EXACTLY what I was after, fantastic jakubi, thanks a lot.

I'm also learning how to build a procedure by studying your code.

thank you,

Patrick.

EXACTLY what I was after, fantastic jakubi, thanks a lot.

I'm also learning how to build a procedure by studying your code.

thank you,

Patrick.

so let's see how I can use this to achieve my underlying purpose.

purpose: in as little notation as possible, display a plot where the default axis has been overwritten by thicker lines (a workaround for the absence of control over axis thickness).

first attempt: I wrote a procedure (my first such) intended to do the above. It almost works. But not quite. The procedure is called "mydisplay" and is intended to replace the standard plots[display]

mydisplay := proc(p)
   local xy, xmin, xmax, ymin, ymax:
   local L1, L2:
   xmin:=-10: xmax:=10:
   L1:=map(x->op(1,x),op([1,1],p)): xmax:=max(L1): xmin:=min(L1):
   L2:=map(x->op(2,x),op([1,1],p)): ymax:=max(L2): ymin:=min(L2):
   xy := (xmin,xmax,ymin,ymax)-> 
   plots:-display(plottools[line]([xmin,0],[xmax,0],thickness=3), 
   plottools[line]([0,ymin],[0,ymax],thickness=3), 
   view=[xmin..xmax,ymin..ymax]):
   plots:-display({p,xy(xmin,xmax,ymin,ymax)},
   view=[xmin..xmax,ymin..ymax]):
   print(%):
 end proc:

Then, I can call the procedure:

p := plot(cos(x), x=-2*Pi..2*Pi):
mydisplay(p);

This sort of works (tested with Maple13/classic). If I want to control the x-axis, I can modify this part: plot(cos(x), x=-2..2): But it doesn't really work in that I have lost the ability to use the view=[-2..2,-0.5..0.5] option. So I need a procedure that can be used more like the standard call to display.

Is it possible to build a procedure that is a slightly modified version of an existing native Maple command?

so let's see how I can use this to achieve my underlying purpose.

purpose: in as little notation as possible, display a plot where the default axis has been overwritten by thicker lines (a workaround for the absence of control over axis thickness).

first attempt: I wrote a procedure (my first such) intended to do the above. It almost works. But not quite. The procedure is called "mydisplay" and is intended to replace the standard plots[display]

mydisplay := proc(p)
   local xy, xmin, xmax, ymin, ymax:
   local L1, L2:
   xmin:=-10: xmax:=10:
   L1:=map(x->op(1,x),op([1,1],p)): xmax:=max(L1): xmin:=min(L1):
   L2:=map(x->op(2,x),op([1,1],p)): ymax:=max(L2): ymin:=min(L2):
   xy := (xmin,xmax,ymin,ymax)-> 
   plots:-display(plottools[line]([xmin,0],[xmax,0],thickness=3), 
   plottools[line]([0,ymin],[0,ymax],thickness=3), 
   view=[xmin..xmax,ymin..ymax]):
   plots:-display({p,xy(xmin,xmax,ymin,ymax)},
   view=[xmin..xmax,ymin..ymax]):
   print(%):
 end proc:

Then, I can call the procedure:

p := plot(cos(x), x=-2*Pi..2*Pi):
mydisplay(p);

This sort of works (tested with Maple13/classic). If I want to control the x-axis, I can modify this part: plot(cos(x), x=-2..2): But it doesn't really work in that I have lost the ability to use the view=[-2..2,-0.5..0.5] option. So I need a procedure that can be used more like the standard call to display.

Is it possible to build a procedure that is a slightly modified version of an existing native Maple command?

then this or something like this should work too?

simplify(%) assuming r::real;

or this:

simplify(%, assume(r,real));

then this or something like this should work too?

simplify(%) assuming r::real;

or this:

simplify(%, assume(r,real));

thanks jakubi, it's nice to know you're looking over our shoulder!

> eval(´c0´ - 86*ln(s) + u(s),
  u(s)=_C1*s^(1/2)*sin(1/2*7^(1/2)*ln(s))
       +_C2*s^(1/2)*cos(1/2*7^(1/2)*ln(s))
       +c1*s*cos(7^(1/2)*ln(s))
       +c2*s*sin(7^(1/2)*ln(s))
       +c3*s):
   eval(%,s=1/r):
   simplify(%) assuming r>0;

(`´c0´`*r^(3/2)+86*ln(r)*r^(3/2)-_C1*sin(1/2*7^(1/2)*ln(r))*r+_C2*cos(1/2*7^(1/2)*ln(r))*r+c1*cos(7^(1/2)*ln(r))*r^(1/2)-c2*sin(7^(1/2)*ln(r))*r^(1/2)+c3*r^(1/2))/r^(3/2) curious... when one writes log(1/r) isn't it implicitly assumed that r>0 ?

thanks jakubi, it's nice to know you're looking over our shoulder!

> eval(´c0´ - 86*ln(s) + u(s),
  u(s)=_C1*s^(1/2)*sin(1/2*7^(1/2)*ln(s))
       +_C2*s^(1/2)*cos(1/2*7^(1/2)*ln(s))
       +c1*s*cos(7^(1/2)*ln(s))
       +c2*s*sin(7^(1/2)*ln(s))
       +c3*s):
   eval(%,s=1/r):
   simplify(%) assuming r>0;

(`´c0´`*r^(3/2)+86*ln(r)*r^(3/2)-_C1*sin(1/2*7^(1/2)*ln(r))*r+_C2*cos(1/2*7^(1/2)*ln(r))*r+c1*cos(7^(1/2)*ln(r))*r^(1/2)-c2*sin(7^(1/2)*ln(r))*r^(1/2)+c3*r^(1/2))/r^(3/2) curious... when one writes log(1/r) isn't it implicitly assumed that r>0 ?

Both methods work ... but yield slightly different values. Interesting.

> de := diff(y(r), r) = 1:
   ic := y(0)=1:
> S := dsolve({de, ic}, y(r), numeric, output=listprocedure):
   Y:= subs(S, y(r)):

> evalf(Int(Y(r)^2 * cos(r), r = 1 .. 2));

                            0.02404977541

> S2:= dsolve({diff(J(r),r) = Y(r)^2 * cos(r), J(1) = 0}, J(r), numeric):
   subs(S2(2), J(r)); 

                        0.0240498760230187549

Both methods work ... but yield slightly different values. Interesting.

> de := diff(y(r), r) = 1:
   ic := y(0)=1:
> S := dsolve({de, ic}, y(r), numeric, output=listprocedure):
   Y:= subs(S, y(r)):

> evalf(Int(Y(r)^2 * cos(r), r = 1 .. 2));

                            0.02404977541

> S2:= dsolve({diff(J(r),r) = Y(r)^2 * cos(r), J(1) = 0}, J(r), numeric):
   subs(S2(2), J(r)); 

                        0.0240498760230187549

log(1/r)=-log(r)

there must be a way to ask Maple to do the simplification, I tried "simplify" on the whole expression but that didn't work, I haven't looked into it but there may be ways to use "simplify" with some option (I think I've seen that done before, check the Help), anyway at this point you can do it by hand.

log(1/r)=-log(r)

there must be a way to ask Maple to do the simplification, I tried "simplify" on the whole expression but that didn't work, I haven't looked into it but there may be ways to use "simplify" with some option (I think I've seen that done before, check the Help), anyway at this point you can do it by hand.

First 85 86 87 88 89 90 91 Page 87 of 93