dharr

Dr. David Harrington

8507 Reputation

22 Badges

21 years, 41 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are replies submitted by dharr

@salim-barzani I think you want to get rid of z:=0; and later put eval(eqt1, z = 0).

@salim-barzani Sorry, I thought it was wrong to just put z=0 in eq17 by any means, assignment or not. I don't understand what you want to do and have no further comment.

@Suryakanth This time OdeSys and Cond are sets, so to combine them in the dsolve call you need dsolve(OdeSys union Cond,...). The D@@2 need parentheses: (D@@2).

Then you call ContoursWithLabels with argument y=yL..yR but the error message says that it received 0=-0.8..1,5, so you must have set y=0 somewhere.

Look at eq17. A few lines later you assign z:=0. So now eq17 has functions with (x,y,0,t) which presumably don't make sense. This carries through and leads to the D[1](f)(x, y, 0, t) - if you still had the z it would display as an indexed derivative.

This sort of assigning is bad practice in Maple for this reason. Better to use eval(..,z=0) to set z zero only in the things you want and not disrupt all earlier expressions. I'm guessing that you only want z=0 for plotting purposes, so perhaps it should be later? But I'm not sure what is intended here.

@Suryakanth I don't know anything about streamlines. In particular you seem to need psi(x,y) when the odes only gave psi(y).

If you are asking about how to make the contourplot work for the psi_fun you give then note that eval(psi(y), Ans[1]) is a procedure so you need to invoke it at y with eval(psi(y), Ans[1])(y). Also y ranged from -1..1 in that function, not 0..400.

So the following makes the plot work.

pulatile_flow_error.mw

@acer I like it!

@salim-barzani You changed the ode so now there is no w. For the other one {A[0],A[1],A[2],B[0],B[1],B[2],w} takes a very long time and I didn't wait. With 7 equations you have several choices for the 7 variables, so you could try some other options. I don't know how to get a solution.

For the long wave length limit I looked at this before and gave part of the solution, but didn't understand how to get the expression with the theta's. If you have some instructions on how to do that I can take a look.

Do you only have coordinate data or do you also know the identity of the atoms? Are you trying to find the identities from the bond lengths? What class of molecules are you interested in? The variety of bond lengths and hence the tolerance question depends significantly on the class of molecules - what does "heavy-atom molecule" mean?

@Alfred_F Add frames = 20. To run the animation click on the plot and then on the play icon on the toolbar.

@sand15 Yes, as I said the wolf only captures the goat in an asymptotic sense. From a more practical point of view the finite-sized wolf catches the finite-size goat after the separation reaches a small number, which I took to be 0.05. Or the 0.05 can just be a number after which you are fairly certain (without an analytical solution) that the wolf will catch the goat at infinite time. The real question about good/bad starting locations has an uninteresting answer that says it doesn't matter - the wolf either never or always catches the goat, depending on your point of view.

I originally programmed the wolf chasing the pre-programmed goat moving in a circle, just to see I had the right physics, thinking I would need to make the goat more clever. So I then made the odes for the goat, with motion on the unit circle, which leads to just the same thing. Once @Alfred_F confirmed the two speeds were each equal and constant, there was not anything else to do.

If one made the two speed maxima, and allowed some acceleration, the wolf and goat to move in arbitrary directions, and allowed the goat to move within the unit circle, the wolf will still catch the goat. Assuming the wolf doesn't start at (1,0) but say from (1+d,0), then the goat and wolf just chase each other in the -x direction until the wolf catches the goat at (-1,0). If the goat deviates, then I think the wolf can anticipate and move to force the goat back toward the x-axis, and catch it after a few oscillations.

@Alfred_F I edited to show that the wolf always catches the goat (at least for the equal-speed case). The simple formulation of the equations comes from Barton J C and Eliezer C J 2000 Journal of the Australian Mathematical Society Series B 41 358, but with both speeds constant. This case means the goat can't have a strategy and sometimes is going towards the wolf. Barton and Eliezer's formulation allows for the wolf/goat speed ratio to be constant, but I think allows each to vary in time, though that is also not a realistic scenario.

It's a nice feature of dsolve that you can feed it a mix of des and equations and it finds a numeric solution (via DAE methods); you don't have to eliminate variables yourself as a prestep.

"he and the goat will be moving at the same speed at the beginning of the hunt and throughout the pursuit" - I assume this means (1) a constant speed for each with each the same, and not (2) the speeds may vary with time, so long as at any time the wolf's speed is equal to the goat's speed.

Are we to assume the wolf never "second guesses" the goat's position, so that the wolf's velocity vector is always pointed directly at the goat? (I assume this is what @janhardo means by focused.)

@salim-barzani I understand the general strategy of what you are doing, but not exactly what you want. My best guess is that you want to convert from one Jacobi function to another. The help page shows how to do this - some are simple and some are not.

restart

de := (diff(G(xi), xi))^2 = lambda[0]+lambda[2]*G(xi)^2+lambda[4]*G(xi)^4

(diff(G(xi), xi))^2 = lambda[0]+lambda[2]*G(xi)^2+lambda[4]*G(xi)^4

We only get the JacobiSN solution

snsol := rhs(select(has, [dsolve(de)], JacobiSN)[])

JacobiSN((1/2)*(2*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)-2*lambda[2])^(1/2)*xi+c__1, (-2*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)*lambda[0]*lambda[4])^(1/2)/(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2))*lambda[0]*2^(1/2)/(lambda[0]*(-lambda[2]+(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)))^(1/2)

nssol := convert(snsol, JacobiNS)

lambda[0]*2^(1/2)/(JacobiNS((1/2)*(2*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)-2*lambda[2])^(1/2)*xi+c__1, (-2*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)*lambda[0]*lambda[4])^(1/2)/(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2))*(lambda[0]*(-lambda[2]+(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)))^(1/2))

amsol := convert(snsol, JacobiAM)

sin(JacobiAM((1/2)*(2*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)-2*lambda[2])^(1/2)*xi+c__1, (-2*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)*lambda[0]*lambda[4])^(1/2)/(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)))*lambda[0]*2^(1/2)/(lambda[0]*(-lambda[2]+(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)))^(1/2)

From the help page

JacobiDN(z, k)^2 = 1-k^2*JacobiSN(z, k)^2; dntosnzk := JacobiSN(z, k) = solve(%, JacobiSN(z, k))[1]; dntosn := eval(dntosnzk, {k = sqrt(-(2*(lambda[2]*sqrt(-4*lambda[0]*lambda[4]+lambda[2]^2)+2*lambda[0]*lambda[4]-lambda[2]^2))*lambda[0]*lambda[4])/(lambda[2]*sqrt(-4*lambda[0]*lambda[4]+lambda[2]^2)+2*lambda[0]*lambda[4]-lambda[2]^2), z = (1/2)*sqrt(2*sqrt(-4*lambda[0]*lambda[4]+lambda[2]^2)-2*lambda[2])*xi+c__1})

JacobiDN(z, k)^2 = 1-k^2*JacobiSN(z, k)^2

JacobiSN(z, k) = (1-JacobiDN(z, k)^2)^(1/2)/k

JacobiSN((1/2)*(2*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)-2*lambda[2])^(1/2)*xi+c__1, (-2*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)*lambda[0]*lambda[4])^(1/2)/(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)) = (1-JacobiDN((1/2)*(2*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)-2*lambda[2])^(1/2)*xi+c__1, (-2*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)*lambda[0]*lambda[4])^(1/2)/(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2))^2)^(1/2)*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)/(-2*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)*lambda[0]*lambda[4])^(1/2)

dnsol := subs(dntosn, snsol)

(1-JacobiDN((1/2)*(2*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)-2*lambda[2])^(1/2)*xi+c__1, (-2*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)*lambda[0]*lambda[4])^(1/2)/(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2))^2)^(1/2)*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)*lambda[0]*2^(1/2)/((-2*(lambda[2]*(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)+2*lambda[0]*lambda[4]-lambda[2]^2)*lambda[0]*lambda[4])^(1/2)*(lambda[0]*(-lambda[2]+(-4*lambda[0]*lambda[4]+lambda[2]^2)^(1/2)))^(1/2))

NULL

Download convertJacobi.mw

@salim-barzani "can we convert it from trigonometric to that shape?". No, you can go from Jacobi to trig by specifying m, but this loses information, so you can't go the other way. If dsolve gives Jacobi, then you can convert it to trig by specifying m.

"and there is any way to do automatically test all that solution in tht table for ode?" If you have the table with the conditions on the parameters, then you just do odetest as you have been. Are you asking about automatically generating the table? Then I do not think so - some variations are far from obvious. What would be the criterion for deciding the table had no further rows? 

I really don't understand the point of the tables. For other cases, I thought the point was listing explicitly real solutions, but here we have solutions such as sn(delta) + I*cn(delta) - it this real for this parameter set. I don't know but it would be hard to decide.

I'm still confused as to what exactly you want. 

1 2 3 4 5 6 7 Last Page 2 of 89