dharr

Dr. David Harrington

8917 Reputation

22 Badges

21 years, 142 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

@JP Howe Here is the way it looks:

Rev00G_2025-11-16_dharr.mw

@JP Howe In Maple 2025.1, I can execute the document with the !!! icon and it completes successfully to the end, producing 4 plots.

@salim-barzani I do not understand what you are saying. I changed parameters and functions to better values and still the result is zero. Perhaps the full pdetest is just too hard for Maple.

C-find.mw

@JP Howe No uploaded file. Use the green up-arrow, choose the file, click "upload" and then click "insert link".

@salim-barzani So for some parameter and function values, it solves the pde. If you found ans was not zero you would know you had made a mistake. To be more certain you could try more parameter options, but you should use random values like 0.27 and not values like 1 that might be special. If you didn't have functions and just numerical parameters then after multiples sets of random parameters you can be relatively certain the answer is right.

The functions are the main problem here since they have to be simple enough for the integration, but t->t is probably too simple.

@salim-barzani 

1. I had an extra parenthesis.

2. You cannot set values for the independent variables x,y,z or t.

3. The integral signs are in a gray color, meaning they are inert, so you need value.

p-test_(2).mw

@Math-dashti The condition in red is the same as that after Eq (9) in your original post (transferred to some other variable names), so it should be correct. If you simplify it, it is Omega(xi)*(expression of constants);

You have a habit of changing the names of variables so they don't match the papers you upload; perhaps to discourage people from answering questions. So perhaps that is true here, and the condition here would be zero with consistent naming. Or it is conservative only if this condition is met. Or that theory doesn't apply to the type of ode you are looking at. In any case, not a Maple issue.

Edit: I see in the paper alpha[1] is a function of k, so you shouldn't have both apha[1] and k in the above expression - if you fix that it should work. I didn't think it was even that paper since you changed phi and y to omega and V.

Your ode is only first order in Omega(xi), so converting it to a first-order system doesn't do anything. If you change it to second order, it works.

make_system.mw

@Math-dashti Maple has a habit of squaring both sides of an equation, which can lead to invalid solutions. It seems that there might not be a solution for the 6 variables you chose

restart

Eqs written as expressions equal to zero.

eq1 := S__1-sqrt((-beta[1]+sqrt(4*k^2*p*beta[2]+4*w*beta[2]+beta[1]^2))/beta[2]); eq2 := S__2-(1/2)*sqrt(-(2*(beta[1]+sqrt(4*k^2*p*beta[2]+4*w*beta[2]+beta[1]^2)))/beta[2]); eq3 := S__3-sqrt(2)*sqrt(chi*(4*chi^2*k^2*p+4*chi^2*w+2*chi*p*beta[1]-p^2*beta[2]))/(4*chi); eq4 := T__1-sqrt(-2*chi*p)/(2*chi)

Equations - note we can't have beta[2] or chi zero

eqs := {eq1, eq2, eq3, eq4}

{S__1-((-beta[1]+(4*k^2*p*beta[2]+4*w*beta[2]+beta[1]^2)^(1/2))/beta[2])^(1/2), S__2-(1/2)*(-2*(beta[1]+(4*k^2*p*beta[2]+4*w*beta[2]+beta[1]^2)^(1/2))/beta[2])^(1/2), S__3-(1/4)*2^(1/2)*(chi*(4*chi^2*k^2*p+4*chi^2*w+2*chi*p*beta[1]-p^2*beta[2]))^(1/2)/chi, T__1-(1/2)*(-2*chi*p)^(1/2)/chi}

indets(eqs, name)

{S__1, S__2, S__3, T__1, chi, k, p, w, beta[1], beta[2]}

See if there is a solution for 6 chosen variables in terms of the others - yes, one solution with beta[2] and k as free parameters.

sol := solve(eqs, {chi, k, p, w, beta[1], beta[2]})

{chi = -4*S__3^2/(beta[2]*(S__1^2*S__2^2-S__1^2*T__1^2-2*S__2^2*T__1^2+2*T__1^4)), k = k, p = 8*T__1^2*S__3^2/(beta[2]*(S__1^2*S__2^2-S__1^2*T__1^2-2*S__2^2*T__1^2+2*T__1^4)), w = -(1/2)*(S__1^4*S__2^4*beta[2]^2-S__1^4*S__2^2*T__1^2*beta[2]^2-2*S__1^2*S__2^4*T__1^2*beta[2]^2+2*S__1^2*S__2^2*T__1^4*beta[2]^2+16*S__3^2*T__1^2*k^2)/(beta[2]*(S__1^2*S__2^2-S__1^2*T__1^2-2*S__2^2*T__1^2+2*T__1^4)), beta[1] = -(1/2)*S__1^2*beta[2]-S__2^2*beta[2], beta[2] = beta[2]}

Check that they are solutions - not immediately zero unless S3 and T1 are zero. But S3 = 0 makes chi=0, which is a problem

simplify(eval(eqs, sol), symbolic)

{0, 2*S__3, 2*T__1}

Can we put over common denominator and take the numerator - now chi is not in the denominator

eqs2 := map(`@`(numer, normal), eqs)

{S__1-((-beta[1]+(4*k^2*p*beta[2]+4*w*beta[2]+beta[1]^2)^(1/2))/beta[2])^(1/2), 2*S__2-(-2*(beta[1]+(4*k^2*p*beta[2]+4*w*beta[2]+beta[1]^2)^(1/2))/beta[2])^(1/2), -2^(1/2)*(chi*(4*chi^2*k^2*p+4*chi^2*w+2*chi*p*beta[1]-p^2*beta[2]))^(1/2)+4*S__3*chi, 2*T__1*chi-(-2*chi*p)^(1/2)}

We get the same solution as before and a new one, which solves the new equations but not the originals

sol2 := [solve(eqs2, {chi, k, p, w, beta[1], beta[2]})]

[{chi = 0, k = k, p = p, w = -(1/2)*S__1^2*S__2^2*beta[2]-p*k^2, beta[1] = -(1/2)*S__1^2*beta[2]-S__2^2*beta[2], beta[2] = beta[2]}, {chi = -4*S__3^2/(beta[2]*(S__1^2*S__2^2-S__1^2*T__1^2-2*S__2^2*T__1^2+2*T__1^4)), k = k, p = 8*T__1^2*S__3^2/(beta[2]*(S__1^2*S__2^2-S__1^2*T__1^2-2*S__2^2*T__1^2+2*T__1^4)), w = -(1/2)*(S__1^4*S__2^4*beta[2]^2-S__1^4*S__2^2*T__1^2*beta[2]^2-2*S__1^2*S__2^4*T__1^2*beta[2]^2+2*S__1^2*S__2^2*T__1^4*beta[2]^2+16*S__3^2*T__1^2*k^2)/(beta[2]*(S__1^2*S__2^2-S__1^2*T__1^2-2*S__2^2*T__1^2+2*T__1^4)), beta[1] = -(1/2)*S__1^2*beta[2]-S__2^2*beta[2], beta[2] = beta[2]}]

sol2[1]

{chi = 0, k = k, p = p, w = -(1/2)*S__1^2*S__2^2*beta[2]-p*k^2, beta[1] = -(1/2)*S__1^2*beta[2]-S__2^2*beta[2], beta[2] = beta[2]}

Put values in

params := {S__1 = 1, S__2 = -1, S__3 = 0, T__1 = 0}; A := eval(sol, params)

{S__1 = 1, S__2 = -1, S__3 = 0, T__1 = 0}

{chi = 0, k = k, p = 0, w = -(1/2)*beta[2], beta[1] = -(3/2)*beta[2], beta[2] = beta[2]}

Choose values for the free parameters

free := {k = 1, beta[2] = 1}

{k = 1, beta[2] = 1}

A11 := `union`(eval(A, free), free)

{1 = 1, chi = 0, k = 1, p = 0, w = -1/2, beta[1] = -3/2, beta[2] = 1}

Check solution to eqs2 - no division by zero but still not valid

simplify(eval(eqs2, `union`(A11, params)))

{0, -2-2^(1/2), 1-2^(1/2)}

NULL

 

NULL

Download find-p1.mw

@awass I think you are worried about unneccesary steps in the algorithm. However, both methods are efficient in this way.

For the output=Array method, dsolve knows where it needs answers and may use intermediate step between these as necessary, but will traverse the range only once. 

For the parameters method (and the usual operation with listprocedure or procedurelist), dsolve remembers internally where it is up to. So if you do ans(2.0) it will step out to 2.0 (with necessary intermediate steps). If you then ask for ans(2.1) it will start at 2.0 and step to 2.1; it does not redo 0 to 2.0. So in @acer's parameters method, Y contains the procedure to evaluate f(x) and it is successively applied to the x values in the Array A, each time just going the extra distance in x.

So both methods work essentially the same way.

The parameters method is more efficient and preferred when you have many parameters, since it does not duplicate the overhead of converting the differential equation to the numerical method each time. It is a bit more complicated to use.

Regarding your misconception about parameters being deprecated, I'm guessing you are thinking about that warning message when you don't use the parameters= option, but just leave a parameter unspecified. That warning message is saying don't leave them unspecified (deprecated), use the "new" parameters= option.

@awass "How does Maple know the size of the Array xpts?" I'm not sure I understand the question. If you mean how does dsolve or plot know, then intenally they just detect its size, e.g., by numelems(xpts), which you could also use. 

If you are asking about how I made xpts have a certain size, I made it from a list, in turn made by the sequence: seq(0..3.0, numelems=20) generates 20 points evenly spaced including the endpoints, so xpts has 20 entries.

@tedh You say you left out your constant, so if we put it back you found (1/4)*x^4 + x^2 + C. Maple left out its constant and if we put it back Maple found (1/4)*x^4 + x^2 + 1 + W. So if the two constants are related by C = 1 + W, then the results are identical.

The value of the constant doesn't really matter, it will cancel out when a definite integral is involved. For example integrating from 0 to 1 from your result we get ((1/4)*1^4 + 1^2) - ((1/4)*0^4 + 0^2) = 5/4 - 0 = 5/4; from Maple's result we get ((1/4)*1^4 + 1^2 + 1) - ((1/4)*0^4 + 0^2 + 1) = 9/4 - 1 = 5/4.

@acer OK. I've edited.

@acer The OP wanted: "Then,  `-\\infty` to `- + \\infty`. "  Seemed like a typo, but I was in a literal mood this morning. Perhaps the OP can clarify.

@Andiguys Not following what tou are doing here, but you didn't include w in the variables to solve for, so maybe that is it?

2 3 4 5 6 7 8 Last Page 4 of 96