awass

291 Reputation

10 Badges

18 years, 71 days

MaplePrimes Activity


These are questions asked by awass

 I want to compute a function W for certain values of x < π/2. W is a ratio of 2 positive values -they are squares-computed using dsolve and that ratio seems to be negative when evalf is applied to the answer.!!!  The true answer (without the evalf) are positive. Also, applying evalf to the correct answers does not produce those silly negative answers. Any suggestions? I would prefer uplaod my file but do not know how>

Here is the file:

This worksheet has a system of ode's ( a second order and a first order), a power series solution near 0 to use for inital conditions, and a function W of the vairables that I want to compute for certain values of x < π/2. W is a ratio of 2 positive values and that ratio seems to be negative when evalf is applied to the answer.!!! The true answer (without the evalf) are positive. Also, applying evalf to the correct answers does not produce those silly negative answers.

  • >  restart;

  • >  alias(B=b(x));alias(Bp=diff(b(x),x));alias(f=F(x));alias(fp=diff(F (x),x));alias(fpp=diff(F(x),x,x));

    B B, Bp

    B, Bp, f B, Bp, f, fp

    B, Bp, f, fp, fpp

  • >  eq1 := sin(x)*(1+B*cos(x)^2)*fpp-(2*((f^2-2*B)*cos(x)^2-f^2+3*B* (1/2)-1))*cos(x)*fp+2*sin(x)*((f^2-3*B*(1/2))*cos(x)^2-f^2+(1/2)* B-1/2)*f = 0;eq2 := (-B*cos(x)^6+(B-1)*cos(x)^4+cos(x)^2)*fp^2+2*f* cos(x)*sin(x)*(cos(x)-1)*(cos(x)+1)*(1+B*cos(x)^2)*fp+cos(x)*sin(x) *Bp+B*cos(x)^6*f^2-(2*(B-1/2))*f^2*cos(x)^4+B*cos(x)^2*f^2-f^2+B = 0;

    eq1 sinx 1 Bcosx2fpp 2 f2 2Bcosx2 f2 3B 1cosxfp 2

    2sinx f2 3B cosx2 f2 B 1 f=0 222

    eq2 Bcos x 6 B 1 cos x 4 cos x 2 fp2 2fcos x sin x cos x
    1 cosx 1 1 Bcosx2 fp cosx sinx Bp Bcosx6f2 2 B

    1 2

(1)

f2cos x 4 Bcos x 2f2 f2 B=0 > f2p:=solve(eq1,fpp);

f2p

(2)

(3)

1 2sin x f3cos x 2 sin x 1 Bcos x 2

2cos x 3fpf2
3sinx fBcosx2 4cosx3fpB 2sinx f3 2cosx fpf2 sinx fB

3cosx fpB sinx f 2cosx fp

  • >  fs:=x^8*(127/604800*C+653/17010*(C^5)+2/81*(C^7)+773/1020600*(C^3)) +x^6*(17/5670*(C^3)-4/81*(C^5)+31/15120*C)+x^4*((1/9)*C^3+7/360*C)+ (1/6)*x^2*C+C:

  • >  Bs:=x^6*(20/189*(C^4)+4/315*(C^2))+4*x^4*C^2*(1/45)+2*x^2*C^2*(1/3) :

  • >  Digits:=15:

  • >  ic:=(c)->{F(1e-5)=subs([x=1e-5,C=c],fs),D(F)(1e-5)=subs([x=1e-5,C= c],diff(fs,x)),b(1e-5)=subs([x=1e-5,C=c],Bs)}:

> nans:=dsolve({eq1,eq2} union ic(c),{f,B},numeric,stiff=true,

(4)

> parameters=[c]);

nans proc x_rosenbrock ... end proc

(4)

(5) (6)

> W:=fp^2*cos(x)/f^2;

W fp2 cos x f2

> Wp:=simplify(subs(fpp=f2p,diff(W,x)));

cosxsinx 1 Bcosx2fp2 f27Bcosx4 f25B3cosx2fpcosxf2

1

1
Wp f3sin x 1 Bcos x 2 4fp 2 f 4

444

3B cosx2 f2 B 1 f2sinx 222

  • >  k:='k': for k from 4 to 5 do nans(parameters=[k]); evalf(eval([W, Wp], nans(Pi/2-1e-10)),5); end do;

    c = 4.
    482.73, 1.3965 10
    8

    c = 5.
    5.6838 10
    6, 1.4948 1013

  • >  k:='k': for k from 4 to 5 do nans(parameters=[k]); eval([W,Wp],

    nans(Pi/2-1e-10)); end do;

    c = 4. 0.0131412243081803, 1.31416436948280 108

    c = 5.
    154.729383663460, 1.54702786932958 10
    12

  • >  evalf([0.0131412243081803, -1.31416436948280*10^8],5);

    0.013141, 1.3142 108

(7)

(8) (9)

 

The dsolve numeric events syntax requires the use of If(a,b,c) rather than the usual if then else syntax. Also, the possible action parts of an event are truly mysterious as are discrete variables. Has anyone plaed around with this much? For example, can the If's be nested? I know I can test that in a toy situation but there are many such questions that arise and I don't want to reinvent the wheel.

I frequently title my plots to identify what is being plotted. Very often that means specifying a parameter. For example, I might want the title to read;  Exponential when the power is c.

In the above I want to replace c with a real number. For example, my command might read

> for c from 1 to 10 do
p||c := plot( x^c, x= -1..1, title= the power is c )
end do:

I can then display the sequence of plots nicely labelled.

That does not work.

 

I cannot find adequate  info about what follows title =  in the help pages or the manual so I end up creating a worksheet and experimenting for quite a while until I find something that works.
(The Help page says: “The value t can be an arbitrary expression.” That’s it. One can go to the typesetting page to get more info about captions which is probably relevant but it begins to feel like learning about sex by looking up words in the dictionary.


BTW, I have been using Maple for 18+ years so I should have a cheat sheet somewhere to remind me of the correct syntax but I am suggesting that Maple would be much more user friendly if this info was in the help pages.

It would be very nice to have a fuller explanation with more examples.

Here is what works:


c:=3;  # special case

 

plot(x^c, x=-1..1,title=`power is `|| c);  Why back quotes?

or

cc:=convert(c,string);
plot(x^c,x=-1..1,title=[`power is `||cc]);   why barckets?

or not as nice
plot(x^c,x=-1..1,title=power.is.cc);  why dots?

or if you get rid of the is
plot(x^c,x=-1..1,title=[power = c]);  why noy use is?

 

not as nice
plot(x^c,x=-1..1,title=[power = cc]);  ugly quote marks

 

Here is a list of failures in this very simple case:

 

c:=3;

 

plot(x^c,x=-1..1,title="power is c");

 

plot(x^c,x=-1..1,title=power is c);

 

 

cc:="c";plot(x^c,x=-1..1,title="power is cc");
or

plot(x^c,x=-1..1,title=power is cc);


plot(x^c,x=-1..1,title=power.is.cc);

 

cc:=convert(c,string);plot(x^c,x=-1..1,title="power is cc");

 

cc:=convert(c,string);plot(x^c,x=-1..1,title="power is cc");

 

plot(x^c,x=-1..1,title='power is cc');

 

plot(x^c,x=-1..1,title=[power, is, cc]);

 

plot(x^c,x=-1..1,title='power = cc');

 

plot(x^c,x=-1..1,title=power = cc); but plot(x^2,x=-1..1,title=[power = cc]);is acceptable

another couple of failures:

plot(x^c,x=-1..1,title=[`power is c`]);

 

plot(x^c,x=-1..1,title=[`power is cc`]);

 

 

I am trying to enter an ODE into Maple and I remember that Dr. Lopez showed how to use a prime to denote differentiation. When I try I get conflicting results: if I type

>  y''+y'+3*y=0;;

Error, unexpected single forward quote
But if I copy that command from the Help page Maple understands what I want. What is going on?

BTW, there is no entry for Differential Equations on the Help page.
 

 

 

The Help pages says:

Import a Worksheet from XML
  Open an existing XML document as a worksheet to modify the content or to change its appearance.
1. From the File menu, select Open. The Open dialog appears.
Select the Maple Worksheet as XML file type.

Those instructions do NOT apply to Maple 2018 on a Mac (although I have verified they DO apply on a Windows machine.) No dialog appears.

My .mw file is 90% format information and thenbits and pieces of Maple code. Is there some way to just extract the maple stuff? The file is pretty long and cutting out the xml stuff is very time consuming.

Thanks,

 

1 2 3 4 5 6 7 Page 2 of 9