Preben Alsholm

13471 Reputation

22 Badges

20 years, 253 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@rahinui Since g is unknown (presumably just evaluates to its own name) then why not just do:
 

restart;
f:=(t1,t2)->cos(g(t1,t2));
D[2](f);
## or
D[2](f)(t1,t2);

After all, unapply is used when the direct method used here is impossible because evaluation is needed as in my example given above with gx. The formal parameters t1 and t2 are in plain sight in cos(g(t1,t2)), so no need for unapply.
###
I do find this behavior unfortunate (at least):
 

restart;
f:=cos@g;
D[2](f);


Error, (in D[2]) index out of range: cos takes only 1 argument(s)

Workaround in your case (basically a joke, but it works):
 

restart;
f:=cos@g;
D[1](f)(t1,t2);
eval(%,D[1]=D[2]);

 

@shrey183 The many curves shown above are orbits of the solutions in phase space: x(t) - values along the x-axis and diff(x(t),t) -values along the y- axis.
The graphs not shown above are graphs of the solutions, i.e. giving x(t) - values along the y-axis and t - values along the x-axis.
But here are those graphs:

Notice that for a given value of t0 and x0 there are infinitely many solutions passing though (t0,x0), one for each slope i.e. for each value y0 of diff(x(t),t) at (t0,x0). Thus it doesn't make any sense to ask for arrows in this plot.

@Math Pi Euler You can do something like this:
 

plots:-display(Array( 
   [seq(
      [seq(plots:-odeplot(Resfu(d),[x,z(x)-eval(Z[k](x),delta=d)],caption=typeset("Error for order ",k, " and delta = ",d )),k=0..3)],
      d=[0.3,0.2,0.1]  )]
   ));

where the result is an array with 3 rows and 4 columns because you got a list of lists of plots like this:
[ [a1,a2,a3,a4], [b1,b2,b3,b4], [c1,c2,c3,c4] ].
MaplePrimes won't accept pasting the array of plots, but you can try it. It worked for me.

I have tried changing the coefficients in the polynomial x^6 -3*x^2-2*x+11 to other integer values and have found no problem when changes were made. I was still using your expression ee.
So a natural question is: What is so special about this particular polynomial?

Just a note on evala.
In versions of Maple from 2016 and earlier your evala(ee) doesn't do anything whatsoever to ee.
If you do

op(3,eval(evala));

in Maple 2016 you get:
`Copyright (c) 1991 by the University of Waterloo. All rights reserved.`
If you do the same in Maple 2017.3 you get
lock, `Copyright (c) 2016 by Maplesoft. All rights reserved.`
and in Maple 2018:
`Copyright (c) 2016 by Maplesoft. All rights reserved.`

I did this many times:
 

restart;
a:=[seq(RootOf(_Z1^6-3*_Z1^2-2*_Z1+11, index = i), i = 1 .. 6)];
ee := a[1]*a[5]+a[2]*a[6]+a[3]*a[4];
evala(ee);

The first time I lost the kernel connection.
Several times I got the correct value 4.
One time I got the alarming error message:

Error, (in evala/Normal/preproc0) this should not happen

 

I have chosen interface(typesetting=standard) in Tools/Options/Display so don't get the problem with INTERVAL.
This works fine:

interface(typesetting=standard);
INTERVAL(1..2, 3..4);

but not if typesetting=extended is used.

I changed the order of alias and seq and repeated the following code including the restart 10 times in one worksheet.
Then executed the worksheet using !!! and doing it several times. I got the result 3.139680582-1.737673929*I each time except for the last digits which varied between 2, 3, and 4 for the real part and 27, 28, 29, 30 for the imaginary part.
 

restart;
alias(seq(a[i] = RootOf(_Z1^6-3*_Z1^2-2*_Z1+11, index = i), i = 1 .. 6));
ee := a[1]*a[5]+a[2]*a[6]+a[3]*a[4];
evalf(evala(ee));

I also tried inserting an evalf(ee) before the evalf(evala(ee)). That made it very likely that 4. was the result, but not consistently. The other result was as above.
 

restart;
alias(seq(a[i] = RootOf(_Z1^6-3*_Z1^2-2*_Z1+11, index = i), i = 1 .. 6));
ee := a[1]*a[5]+a[2]*a[6]+a[3]*a[4];
evalf(ee);
evalf(evala(ee));

I use the 64 bit version of Maple 2018.
## Addendum
The following also mostly return 4 but not consistently:
 

restart;
alias(seq(a[i] = RootOf(_Z^6-3*_Z^2-2*_Z+11, index = i), i = 1 .. 6));
ee := a[1]*a[5]+a[2]*a[6]+a[3]*a[4];
evala(a[1]); # has an effect apparently
evala(ee);

 

You cannot have infinity in your boundary conditions.
You may have a look at the building blocks for a possible series solution:
 

pdsolve(pde,build);

 

@Math Pi Euler Just do Z[3](0) if x = 0.
I added a comparison to the numerical solution as done in my other answer.

You are saying that B2211 is positive since B211 and B221 are.
The problem with that is that both B211 and B221 don't remain positive.
MaplePrimes18-03-24_odesys.mw

The plot of B211 and B221:

If your system doesn't behave the way you expect I'm pretty sure it has absolutely nothing to do with odeplot.
My guess is that the problem (if there is one) is in your own formulation of the problem sent to dsolve.
Just take a look at sol(3000) which produces

quite independent of odeplot. I'm also pretty confident that dsolve doesn't make blunders like that.

Nothing is attached.

@CK1992 What it means is that
 

exp(g(x,0)*sqrt(x)/(1+varepsilon*g(x,0)*sqrt(x)))
## is replaced by
1+g(x,0)*sqrt(x)/(1+varepsilon*g(x,0)*sqrt(x)

Starting from BC you can make the replacement like this:
 

BC2:=eval(BC,exp=(x->1+x));

so when varepsilon=0 you get
 

BC2 := {g(0, eta) = 0, g(x, 20) = 0, phi(0, eta) = 1, phi(x, 20) = 1, D[2](g)(x, 0) = -phi(x, 0)*(1+g(x, 0)*sqrt(x)), D[2](phi)(x, 0) = 0}

I did that in a desperate attempt to get some result. That replacement can only be expected to be any good if the argument to exp is small. The argument is g(x, 0)*sqrt(x)/(1+varepsilon*g(x, 0)*sqrt(x)) and that is only small if g(x, 0)*sqrt(x) is small.
So it doesn't look promising, does it?

@CK1992 In fact I tried using an eta value greater than zero. That worked better at least when using the approximation exp(x) = 1+x. Also I used spacestep=0.1.
Another thing: The boundary value for D(T) is given at eta=20, i.e. you have D(T)(20) = 0.
Could that (or should that) be chosen smaller, e.g. eta=10?
The reason I ask is that the plots

plots:-odeplot(sol1,[[eta,T(eta)],[eta,diff(T(eta),eta)]]);

show that T and T' has become basically constant already at eta=10.
Using that also, this produced a seemingly exponentially growing g*sqrt(x):
 

pds:-plot(g*sqrt(x), x = 0 ..3 , eta = .0001, color = red);

But remember, I was using exp(x) = 1+x, so no great news.

 

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