Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@Mekai Actually I doubt that this package (Gym) is not used although I cannot be sure since the worksheet doesn't work for you either.
Anyway, what is the intended meaning of the input, which at my computer gives an error:

Error, invalid neutral operator

If I convert to 1D input I get the horribly looking

4⟦A⟧120∠+2.5⟦A⟧60∠

which surely makes no sense whatsoever (to me).


@Mekai In your very short worksheet you are trying to load a package called Gym. That package doesn't come with the standard installation of Maple. I guess it is provided by your instructor?

Do you have any reason to believe that there is a nontrivial solution?

Certainly the zero solution is a solution:

odetest({f1(x)=0,f2(x)=0,f3(x)=0,f4(x)=0},dsys3); #The trivial solution is a solution!

Maybe you should look at the link given above.

Your immediate problems can be handled by differentiating the first ode twice, the second once, keeping the remaining two as they are. The resulting system can be solved for the highest derivatives: So convertsys will work.
You have to add the extra boundary conditions you get from the first ode and its derivative, and from the second ode.

However, you will get the trivial solution.

#On reviewing this I realized I misread the highest diff order of f4: I had it at 4, it is 2.
Thus the method above can be simplified to:
Differentiate the second ode once and consider the system with that and the remaining 3 equations. Use the second ode (undifferentiated) at x=0 as an additional boundary condition. The result is still just the zero solution as expected.

This reminds me of the discussion in

http://mapleprimes.com/questions/204986-Dsolve-With-Unknown-Parameter#answer218470

So may be you ought to say where you got the ideas? It may in fact help the person, who helped with a previous situation of the same sort in finding the relevant worksheet used at the time.

You don't explain why you are doing what you are doing: e.g. why you don't just try to use dsolve on dsys3?
Are people supposed to guess that or find out themselves the hard way?

@iman The second derivative with respect to the first variable of w at the point (0,z) is written
D[1,1](w)(0,z)

Similarly with the other derivatives in IBC3. Thus IBC3 should be

IBC3:={D[2](Phi)(x, h/2)+2*D[1,1](w)(x, h/2) = 0, D[2](Phi)(x,h/2)+2*D[1,1](w)(x,-h/2) = 0, -7*D[1,1](w)(0, z)+2*Phi(0, h/2)-Phi(0, -h/2) = 0, -7*D[1,1](w)(L, z)+2*Phi(L, h/2)-Phi(L, -h/2) = 0, Phi(0, z) = 0, Phi(L, z) = 0, u(0, z) = 0, u(L, z) = 0, w(0, z) = 0, w(L, z) = 0};

Now the next problem you face is not syntax, but the fact that the algorithm used cannot handle derivatives that are not normal to the boundary: The error message says as much:

In IBC3 the derivative D[2](Phi)(x, h/2) is perfectly fine: It is a derivative w.r.t. to the second variable (z) and the boundary is z=h/2, thus that derivative is normal to the boundary.
However, the derivative D[1,1](w)(x, h/2) is not normal to the boundary as it is a (second) derivative w.r.t. the first variable (x).
Maybe you intended that derivative to be D[2,2](w)(x, h/2) ?
But your problems don't end there: IBC3 also has Phi(0, h/2), which is just Phi at one point. You need to give Phi along an axis, i.e. the different ibcs should each depend on exactly one of the two independent variables (x or z).

Finally, if all that is taken care of, you will most likely run into a problem with the appearance of diff(Phi(x, h/2), x, x) in your system of pdes.
As a simple example of the problem:
restart;
pde:=diff(u(x,t),t)=diff(u(x,t),x,x); #The heat equation
res:=pdsolve(pde,{u(x,0)=x,u(0,t)=0,u(1,t)=0},numeric);
res:-animate(t=1); #Perfectly fine
#Now consider the following changed version:
pde2:=diff(u(x,t),t)=diff(u(x,t),x,x)+diff(u(x,0),x); #Notice the appearance of diff(u(x,0),x)
res:=pdsolve(pde2,{u(x,0)=x,u(0,t)=0,u(1,t)=0},numeric);
res:-animate(t=1); #ERROR





@golnaz I think that I actually answered that in giving

plot([2*IB(z,1/5,1/2),z,z=0..1]);

You just have to replace IB by
IBcrt:=(t,a,b)->IB(t^(1/3),a,b);

as I actually implied above in giving IBsqrt.
I have noticed that you changed t^(0.5) fo t^(1/3), so I changed IBsqrt to IBcrt.

@iman Well, actually I expected you to do the work, not me.
You may want to read the help for D.
?D
and the help for pdsolve/numeric:
?pdsolve,numeric
See the examples.

@golnaz You are right. The inverse of the incomplete beta function evaluated at half the argument is not what I gave.
There is still confusion about the square root, but that confusion has nothing to do with that issue:

restart;
IB(x,a,b)=Int(t^(a-1)*(1-t)^(b-1),t=0..x); #This is the definition of the incomplete beta function
##Now we find it as a function of x,a,b:
B:=int(t^(a-1)*(1-t)^(b-1),t=0..x);
IB:=unapply(B,x,a,b);
##The confusion mentioned is: Did you mean the following one instead?
#IBsqrt:=(t,a,b)->IB(sqrt(t),a,b);
plot(IB(x,1/5,1/2),x=0..1); #The graph of IB as a function of x.
plot([IB(x,1/5,1/2),x,x=0..1]); #Graph of inverse of x->IB(x,1/5,1/2) (call it invIB )
plot([2*IB(z,1/5,1/2),z,z=0..1]); #This is the graph of invIB(f/2) as a function of f.

The argument is that the graph of invIB(f/2) we can get as
[f, invIB(f/2), f=0..2*IB(1)]
This graph is also obtained by using z=invIB(f/2), i.e. f=2*IB(z):
[2*IB(z),z,z=0..1]
##I edited the answer above to correct this error. Notice though that there I still use the square root.


I'm somewhat surprised (to put it mildly) that you don't link to your previous question:

http://www.mapleprimes.com/questions/205318-Error-In-DEplot#comment219317

@rit I used the right hand sides 0, 3*t^2, and 2*t^3. Notice that I was in doubt about what you meant them to be. Clearly with these right hand sides neither system is autonomous, so the concept of sink or source is not applicable.

So give us the system with equality signs, so that the question "autonomous or not?" can be settled. To find equilibria and determine eigenvalues for the jacobian at those points can then be done.

You have three unknowns (a(t), b(t), c(t) ) and  two odes.

I copied your 2 lines and had no problem. The result returned was -36949.67738.

Maybe you should try your own 2 lines again after a restart.

@emmantop You copied my code incorrectly. It should be

dsolve(eval({ode1, ode2} union BCS, E union {k[1]= 0}), numeric, method = bvp[midrich], abserr = 1.10^(-8))

Notice that there we have {k[1]=0} and NOT {k[1]}=0.

You had
`union`(E, {k[1]}) = 0

which is equivalent to

E union {k[1]} = 0

which is (basically) nonsense, but not unsyntactical (in Maple).

Let me add that what I referred to as "weird" is really just the zero solution for f. When D(f)(0)=1 is removed then all f related boundary conditions are homogeneous and f(eta)=0 solves ode1.
Another thing while at it:  Did you really want abserr = 1.10^(-8)? That would be abserr=0.4665073802.
I had success (i.e. in two cases as before mentioned) with abserr=1e-5.

@Axel Vogt Epsilon prints like a capital epsilon, which ought to be fine.

By the way I don't see the solution found by Carl in your reduced system.

Another thing: I cannot make fsolve give a result on Sys[2] without omitting convert/rational. Without that, no problem.

Using solve on the equations without assignment to the constants gives two real solutions altogether when assigning afterwards:

For ppsi = .1561816797:
{A1 = .2178679378, A2 = 0, C0 = 0, C1 = 0, C2 = 0, E0 = 2.923409461, H = 1.169518511, H1 = -3.370336272, K = .2120924177, L0 = -1.923409459, L1 = 1, R = 0.1077611106e-1, W = .4031652600, Y = .6858871836, Epsilon1 = -1.108403687}
and
{A1 = .1151377592, A2 = -0.2771025818e-1, C0 = -0.2106664520e-1, C1 = -0.3108676424e-1, C2 = -0.4587284305e-1, E0 = 2.923409461, H = .9700004405, H1 = -.4209490949, K = 0.8582496732e-1, L0 = -3.093516599, L1 = -.1854153076, R = .655446246, W = .3221564949, Y = .4545705612, Epsilon1 = .2686838282}

For ppsi=1.947717707:
{A1 = 0.1146472975e-1, A2 = 0, C0 = 0, C1 = 0, C2 = 0, E0 = .2344194943, H = 0.9509540701e-1, H1 = 0.6343537741e-1, K = 0.1116080812e-1, L0 = .7655805057, L1 = 1, R = .3632312348, W = .3518971259, Y = 0.4867856263e-1, Epsilon1 = 0.3694572998e-1}
and
{A1 = 0.1429702382e-2, A2 = 0.5359982543e-1, C0 = 0.4074911503e-1, C1 = 0.6013098524e-1, C2 = 0.8873162983e-1, E0 = .2344194943, H = .5898272830, H1 = 1.456583019, K = 0.5218750955e-1, L0 = .1114825845, L1 = .3373447074, R = .655446246, W = .3221564946, Y = .2764103064, Epsilon1 = 0.4295105618e-1}

The above results were computed with Digits=10, but confirmed with Digits=15.

(NOTE: Second value of ppsi).
Since you know the solution you can use that as a starting point for fsolve just to verify the result, always a good idea.
With the method I mentioned in my previous comment (but didn't elaborate on) I found

{A1 = 0.142970229228308e-2, A2 = 0.535998252919882e-1, C0 = 0.407491149283945e-1, C1 = 0.601309851312542e-1, C2 = 0.887316296122945e-1, E0 = .234419494359216, H = .589827281889861, H1 = 1.45658301648039, K = 0.521875094397844e-1, L0 = .111482584275646, L1 = .337344707782075, R = .655446246865986, W = .322156494043605, Y = .276410305860281, Epsilon1 = 0.429510561240001e-1}

which is the one you are talking about.

Using a starting point can help fsolve quite a lot. So any method that will provide you with an approximate solution may help.

First 107 108 109 110 111 112 113 Last Page 109 of 231