dharr

Dr. David Harrington

8477 Reputation

22 Badges

21 years, 33 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 answers submitted by dharr

If you make a larger size plot using size=[1000,1000] then you can get minimal overlap. The orientation of the plot differs each time you hit enter on the DrawGraph command, and that influences the amount of overlap, so you want to repeat until you get a nice result. Then exporting with the right-click menu to prn gives you a 1000x1000 pixel image.

Download DrawGraph.mw

This is the  output prn file:

Here I removed the singularity by multiplying by the denominator and so derived Eq. 9. Is that what you wanted or were you looking for something more? Maybe the ConservedCurrents would work after a while. But the condition in the paper does not seem to be satisfied by alpha[5]=0, n=2/3.

For the equilibria, if you don't like the complicated solutions, I think you will just have to give the parameters some numerical values and use fsolve.

restart

with(PDEtools)

with(plots)

with(plots):

with(DEtools):

undeclare(prime, quiet)

with(LinearAlgebra)

NULL

ode := n*Omega(xi)*(2*alpha[6]*n*Omega(xi)^2+alpha[5]*n*Omega(xi)+beta)*(diff(diff(Omega(xi), xi), xi))+(2*alpha[6]*n^2*Omega(xi)^2-beta*(n-1))*(diff(Omega(xi), xi))^2-n^2*Omega(xi)^2*(-alpha[4]*Omega(xi)^4-alpha[3]*Omega(xi)^3+beta*k^2-Omega(xi)^2*alpha[2]-Omega(xi)*alpha[1]+w) = 0

n*Omega(xi)*(2*alpha[6]*n*Omega(xi)^2+alpha[5]*n*Omega(xi)+beta)*(diff(diff(Omega(xi), xi), xi))+(2*alpha[6]*n^2*Omega(xi)^2-beta*(n-1))*(diff(Omega(xi), xi))^2-n^2*Omega(xi)^2*(-alpha[4]*Omega(xi)^4-alpha[3]*Omega(xi)^3+beta*k^2-Omega(xi)^2*alpha[2]-Omega(xi)*alpha[1]+w) = 0

#Typesetting:-Settings(prime=xi):
#Typesetting:-Settings(typesetprime=true):

I don't know why Q, QP doesn't work here, but you need to specify otherwise it is hard to work with the escaped locals Y and YP chosen by default.

raw := DEtools[convertsys]({ode}, {}, Omega(xi), xi, s, QP, QP)[1..2];

[[QP[1] = s[2], QP[2] = (-(2*alpha[6]*n^2*s[1]^2-beta*(n-1))*s[2]^2+n^2*s[1]^2*(-alpha[4]*s[1]^4-alpha[3]*s[1]^3+beta*k^2-alpha[2]*s[1]^2-alpha[1]*s[1]+w))/(n*s[1]*(2*n*alpha[6]*s[1]^2+n*alpha[5]*s[1]+beta))], [s[1] = Omega(xi), s[2] = diff(Omega(xi), xi)]]

Extract the denominator and scale the right hand sides by it

den:=denom(eval(QP[2],raw[1]));
raw_eta:=map(q->rhs(q)*den,raw[1]);

n*s[1]*(2*n*alpha[6]*s[1]^2+n*alpha[5]*s[1]+beta)

[s[2]*n*s[1]*(2*n*alpha[6]*s[1]^2+n*alpha[5]*s[1]+beta), -(2*alpha[6]*n^2*s[1]^2-beta*(n-1))*s[2]^2+n^2*s[1]^2*(-alpha[4]*s[1]^4-alpha[3]*s[1]^3+beta*k^2-alpha[2]*s[1]^2-alpha[1]*s[1]+w)]

Back to the real transformed variables, which are now in terms of eta.

rhs_eta := eval(raw_eta, {s[1] = Omega(eta), s[2] = y(eta)})

[y(eta)*n*Omega(eta)*(2*alpha[6]*n*Omega(eta)^2+alpha[5]*n*Omega(eta)+beta), -(2*alpha[6]*n^2*Omega(eta)^2-beta*(n-1))*y(eta)^2+n^2*Omega(eta)^2*(-alpha[4]*Omega(eta)^4-alpha[3]*Omega(eta)^3+beta*k^2-Omega(eta)^2*alpha[2]-Omega(eta)*alpha[1]+w)]

Find equilibrium points - one is at the origin; the others are a complicated mess.

equilibria := [solve(rhs_eta, {Omega(eta), y(eta)}, explicit)]; nops(%)

9

Eq 9.

de1 := diff(Omega(eta), eta) = rhs_eta[1]; de2 := diff(y(eta), eta) = rhs_eta[2]

diff(Omega(eta), eta) = y(eta)*n*Omega(eta)*(2*alpha[6]*n*Omega(eta)^2+alpha[5]*n*Omega(eta)+beta)

diff(y(eta), eta) = -(2*alpha[6]*n^2*Omega(eta)^2-beta*(n-1))*y(eta)^2+n^2*Omega(eta)^2*(-alpha[4]*Omega(eta)^4-alpha[3]*Omega(eta)^3+beta*k^2-Omega(eta)^2*alpha[2]-Omega(eta)*alpha[1]+w)

#now we need to construct conservative quantity

Following is too slow, but might work.

We want the condition diff(P,Omega) = -diff(Q,y), so we want the following to be zero

cons_eq := Physics:-diff(rhs_eta[1], Omega(eta))+Physics:-diff(rhs_eta[2], y(eta))

y(eta)*n*(2*alpha[6]*n*Omega(eta)^2+alpha[5]*n*Omega(eta)+beta)+y(eta)*n*Omega(eta)*(4*n*Omega(eta)*alpha[6]+n*alpha[5])-2*(2*alpha[6]*n^2*Omega(eta)^2-beta*(n-1))*y(eta)

According to the paper this is satisfied for alpha[5]=0,n=2/3 but this seems not to be the case.

factor(cons_eq); eval(%, {n = 2/3, alpha[5] = 0})

y(eta)*(2*alpha[6]*n^2*Omega(eta)^2+2*Omega(eta)*alpha[5]*n^2+3*beta*n-2*beta)

(8/9)*y(eta)*alpha[6]*Omega(eta)^2

``

Download bi-1.mw

Following @rcorless's suggestion, a "dimensional" analysis allows us to eliminate two variables, but we still cannot solve it in any reasonable time; the same conclusion that @sand15 came to.

restart

with(LinearAlgebra); with(SolveTools)

K2 := -(Pn-Pr)/(1-delta)+(-beta*((-2*delta+2)*tau^2+((-Pn+Pr-delta+1)*Cr+(-2+2*delta)*(w+i2))*tau+Cr*i2*(-1+delta+Pn-Pr))*upsilon/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))+Pr)/delta+(Pr-w-Cr)*beta*(-2+2*delta)*tau*upsilon/(((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))*delta) = 0

K3 := 1-(Pn-Pr)/(1-delta)-(Pn-Cn)/(1-delta)+(Pr-w-Cr)*(1/(1-delta)-(-beta*(Cr*i2-Cr*tau)*upsilon/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))+beta*((-2*delta+2)*tau^2+((-Pn+Pr-delta+1)*Cr+(-2+2*delta)*(w+i2))*tau+Cr*i2*(-1+delta+Pn-Pr))*upsilon*Cr/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))^2)/delta)+Ce*rho0/(1-delta) = 0

K4 := (Pn-Cn)/(1-delta)+(Pn-Pr)/(1-delta)-(-beta*((-2*delta+2)*tau^2+((-Pn+Pr-delta+1)*Cr+(-2+2*delta)*(w+i2))*tau+Cr*i2*(-1+delta+Pn-Pr))*upsilon/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))+Pr)/delta+(Pr-w-Cr)*(-1/(1-delta)-(-beta*(-Cr*i2+Cr*tau)*upsilon/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))-beta*((-2*delta+2)*tau^2+((-Pn+Pr-delta+1)*Cr+(-2+2*delta)*(w+i2))*tau+Cr*i2*(-1+delta+Pn-Pr))*upsilon*Cr/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))^2+1)/delta)-Ce*rho0/(1-delta) = 0

vars := {Pn, Pr, w}

{Pn, Pr, w}

Write as numerator over denominator then just take the numerators, which we want equal to zero.

Q2 := numer(normal(lhs(K2))); Q3 := numer(normal(lhs(K3))); Q4 := numer(normal(lhs(K4)))

Let's try @rcorless's suggestion to reduce the number of variables.
All the terms in Q2 have the same dimensions. If we divide all terms by the first term, then each of the new terms is dimensionless.

Q2nondims := op(2 .. (), expand(Q2/op(1, Q2)))

Pr*tau/(Pn*i2), -2*delta*Pr*tau/(Cr*Pn*i2), 4*delta*tau*w/(Cr*Pn*i2), -Pr*tau/(Pn*delta*i2), 4*Pr*tau/(Cr*Pn*i2), -8*tau*w/(Cr*Pn*i2), -2*Pr*tau/(Cr*Pn*delta*i2), 4*tau*w/(Cr*Pn*delta*i2), 4*Pr*tau/(Cr*Pn*beta*i2*upsilon), -4*Pr*tau/(Cr*Pn*beta*delta*i2*upsilon), -1/delta, -tau/i2, -Pr/Pn, delta*tau/(Pn*i2), 2*delta*tau/(Cr*Pn), -2*delta*tau^2/(Cr*Pn*i2), tau/(delta*i2), Pr/(Pn*delta), -2*tau/(Pn*i2), -4*tau/(Cr*Pn), 4*tau^2/(Cr*Pn*i2), Pr/(beta*i2*upsilon), tau/(Pn*delta*i2), -4*delta*tau/(Cr*beta*i2*upsilon), 2*tau/(Cr*Pn*delta), -2*tau^2/(Cr*Pn*delta*i2), Pr/(beta*delta*i2*upsilon), -Pr^2/(Pn*beta*delta*i2*upsilon), Pr/(Pn*beta*i2*upsilon), 4*tau/(Cr*beta*i2*upsilon), -Pr/(Pn*beta*delta*i2*upsilon), 1/(beta*i2*upsilon), -2/Pn, -Pn/(beta*i2*upsilon), -delta/(beta*i2*upsilon), 1/(Pn*delta), delta/Pn

Combine with the ones from Q3 and Q4 and remove duplicates. We want the "real" variables Pr, Pn and w last.

terms := [{Q2nondims, op(2 .. (), expand(Q3/op(1, Q3))), op(2 .. (), expand(Q4/op(1, Q4)))}[]]; nterms := nops(terms); allvars := [(`minus`(indets(terms), vars))[], vars[]]; nvars := nops(allvars)

386

[Ce, Cn, Cr, beta, delta, i2, rho0, tau, upsilon, Pn, Pr, w]

12

We construct a matrix K that contains the powers of allvars (rows) in each of the terms (columns)
Matrix K has 12 rows but rank 10, so we can eliminate 12-10=2 variables. The code below shows we can, for example eliminate beta and Ce (these are the ones = 1 in "rewrites").

K := Matrix(nvars, nterms, (i, j) -> diff(terms[j], allvars[i])*allvars[i]/terms[j]):
DataFrame(K,rows=allvars,columns=[$nops(terms)]);
r1:=Rank(K);

DataFrame(_rtable[36893490580276833924], rows = [Ce, Cn, Cr, beta, delta, i2, rho0, tau, upsilon, Pn, Pr, w], columns = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386])

10

Some technical stuff. See E. Hubert, G, Labahn, Found Comput Math 13 (2013) 479–516, doi:10.1007/s10208-013-9165-9.

or https://youtu.be/Nl2FBAbU1pE

H, U := HermiteForm(K, output = ['H', 'U'], method = 'integer'):
Determinant(U):
A := U[-nvars + r1 .. -1, ..]:
rA := Rank(A):
V:=ColumnHermiteFormSpecial(A): #ColumnHermiteFormSpecial is in startup region
# Find the non-dim variables
nondims := table():
for i to nvars-rA do
        nondimvars[i]:=cat(allvars[i+rA], "__new");
        nondims[i] := nondimvars[i] = mul(allvars^~V[.., i+rA]);
end do:
nondimvars:=convert(nondimvars,list):
nondims:=convert(nondims, list);
W:=V^(-1):
Wd:=W[-(nvars-rA)..-1,..]:
rewrites := table():
for i to nvars do
        rewrites[i] := allvars[i] = mul(nondimvars^~Wd[.., i])
end do:
rewrites := convert(rewrites, list);

[Cr__new = Cn, beta__new = Cr, delta__new = delta, i2__new = i2, rho0__new = Ce*rho0, tau__new = tau, upsilon__new = beta*upsilon, Pn__new = Pn, Pr__new = Pr, w__new = w]

[Ce = 1, Cn = Cr__new, Cr = beta__new, beta = 1, delta = delta__new, i2 = i2__new, rho0 = rho0__new, tau = tau__new, upsilon = upsilon__new, Pn = Pn__new, Pr = Pr__new, w = w__new]

The naming isn't optimal here so we'll ignore it and make up our own. Basically (see nondims), we can leave all variables the same except introduce R=Ce*rho0, B=beta*upsilon. (I used R instead of rho0__new, B instead of upsilon_new.) So we need to do the following substitutions to get rid of Ce and beta.

eqBR := {B = beta*upsilon, R = Ce*rho0}; eqCebeta := solve(eqBR, {Ce, beta}); eqs := eval({Q2, Q3, Q4}, eqCebeta); newvars := indets(eqs)

{B = beta*upsilon, R = Ce*rho0}

{Ce = R/rho0, beta = B/upsilon}

{B, Cn, Cr, Pn, Pr, R, delta, i2, tau, w}

We are down to 3 unknowns and 7 parameters, but this is still too hard for solve. Trying a polynomial solve specifying that we want vars in terms of the others is still too slow. We can get solutions without backsubstitution if we let it choose the solver choose the variable order by specifying newvars as a set.

sols := [PolynomialSystem(eqs, newvars, engine = triade, backsubstitute = false)]; nops(%)

8

We have 8 solutions. Some are simple, e.g. tau=Cr=0.  We should check that even if they solve {Q2,Q3,Q4}, they also don't give a division by zero error for {K2,K3,K4}

sols[2]; eval({Q2, Q3, Q4}, {Cr = 0, tau = 0}); eval({K2, K3, K4}, {Cr = 0, tau = 0})

[[tau, Cr], {}]

{0}

Error, numeric exception: division by zero

For solution 1 we have B=0 (so either beta=0 or upsilon=0), and a range of solutions only for particular relationships involving Pn-Pr, not Pn and Pr separately. The solution is only valid when delta is not 1.

sols[1]; eqPn := isolate(%[1][2], Pn); simplify(eval(eval({Q2, Q3, Q4}, eqBR), {eqPn, beta = 0})); simplify(eval(eval({K2, K3, K4}, eqBR), {eqPn, beta = 0}))

[[B, (4*delta-4)*tau+Cr*(-Pr+Pn+delta-1)], {4*delta-4 <> 0}]

Pn = -(4*delta-4)*tau/Cr+Pr-delta+1

{0}

Error, numeric exception: division by zero

This one also depends on Pn-Pr

sols[3]; simplify(eval(eval({Q2, Q3, Q4}, eqBR), {Pn = Pr-delta+1, tau = 0})); simplify(eval(eval({K2, K3, K4}, eqBR), {Pn = Pr-delta+1, tau = 0}))

[[tau, Pr-Pn-delta+1], {}]

{0}

Error, numeric exception: division by zero

Cr = 0 and delta=1 is a solution but not to the originals

sols[4]; eval({Q2, Q3, Q4}, {Cr = 0, delta = 1}); eval({K2, K3, K4}, {Cr = 0, delta = 1})

[[Cr, delta-1], {}]

{0}

Error, numeric exception: division by zero

The next one has only the combination Pr-Pn=0 i.e. Pr=Pn

sols[5]; eval({Q2, Q3, Q4}, {Pr = Pn, delta = 1}); eval({K2, K3, K4}, {Pr = Pn, delta = 1})

[[Pr-Pn, delta-1], {}]

{0}

Error, numeric exception: division by zero

Similar to above but a more complicated relationship. For a given Pr we can get w and Pn. delta=0

sols[8]; eqwPn := eval(solve(%[1][1 .. 2], {Pn, w}), eqBR); simplify(eval(eval({Q2, Q3, Q4}, eqBR), {eqwPn[], delta = 0})); simplify(eval(eval({K2, K3, K4}, eqBR), {eqwPn[], delta = 0}))

[[((-Pn+Pr+1)*Cr+2*tau)*B*i2+(-2*tau^2+((Pn-Pr-3)*Cr+2*Pr)*tau)*B-4*tau*Pr+((Pn-1)*Pr-Pr^2)*Cr, w+Cr-Pr, delta], {((-Pn+Pr+1)*Cr+2*tau)*B <> 0}]

{Pn = (Cr*Pr*beta*i2*upsilon-Cr*Pr*beta*tau*upsilon+Cr*beta*i2*upsilon-3*Cr*beta*tau*upsilon+2*Pr*beta*tau*upsilon+2*beta*i2*tau*upsilon-2*beta*tau^2*upsilon-Cr*Pr^2-Cr*Pr-4*Pr*tau)/(Cr*(beta*i2*upsilon-beta*tau*upsilon-Pr)), w = -Cr+Pr}

{0}

Error, numeric exception: division by zero

In this case we get a solution for all of Pr,Pn,w for {Q2,Q3,Q4} but not for the original system. Close!

sols[7]; eqwPn := eval(solve(%[1], {Pn, Pr, w}), eqBR); simplify(eval(eval({Q2, Q3, Q4}, eqBR), eqwPn)); simplify(eval(eval({K2, K3, K4}, eqBR), eqwPn))

[[(Pr-Pn-delta+1)*Cr*i2+(4*delta-4)*tau^2+((2*Pn-2*Pr+6*delta-6)*Cr+(-4*delta+4)*Pr)*tau, w+Cr-Pr, (4*delta-4)*tau+Cr*(-Pr+Pn+delta-1)], {(Pr-Pn-delta+1)*Cr <> 0, 4*delta-4 <> 0}]

{Pn = (Cr^2-Cr*delta+Cr*i2-Cr*tau-4*delta*tau+Cr+4*tau)/Cr, Pr = i2-tau+Cr, w = i2-tau}

{0}

Error, (in simplify/normal) numeric exception: division by zero

And now the hard one, which is probably not so different from the original

sol6 := sols[6][1]; nops(%); map(indets, sol6)

3

[{B, Cn, Cr, Pn, Pr, R, delta, i2, tau, w}, {B, Cr, Pn, Pr, delta, i2, tau, w}, {B, Cr, Pn, Pr, delta, tau, w}]

And we still cannot solve this in any reasonable time.

sol6b := PolynomialSystem(sol6, vars, engine = triade)

NULL

 

Download Q_solve2.mw

Corrected. I entered psi(y) directly instead of using psi:=psi(y). You can use diff_table to shorten how the odes are entered, but then you also shorten how the derivatives are entered.

The first and second derivatives of a function of 1 variable are D(psi)(1) and (D@@2)(psi)(1); the D[1] and D[2] notation means derivative wrt 1st or 2nd variable if you have a function of two variables.

OdeSys and Cond should have been sequences not lists; you then can combine them into the single list [OdeSys,Cond].

I changed the y range from -1.5..1.5 to -1..1 to agree with the bcs otherwise odeplot gives a warning and changes them anyway.

All your plots are on top of each other; I guess the value of Rd doesn't make much difference.

restart; with(DEtools); with(plots); Mn := .1; We := .1; Omega := .1; Grt := .1; Grc := .1; Grf := .1; Pr := .1; Nb := .1; Nt := .1; Ntc := .1; Nct := .1; beta := .1; alpha := .1; f := .1; eq1 := diff(psi(y), `$`(y, 4))-Mn^2*(diff(psi(y), `$`(y, 2)))/(Omega^2+1)+Grt*theta(y)+Grc*phi(y)-Grf*gamma(y)-2*We^2*(Mn^2*(diff(psi(y), `$`(y, 2)))/(Omega^2+1)-Grt*theta(y)-Grc*phi(y)+Grf*gamma(y))^3 = 0; eq2 := (Pr*Rd+1)*(diff(theta(y), `$`(y, 2)))+Nb*Pr*(diff(theta(y), y))*(diff(gamma(y), y))+Nt*Pr*(diff(theta(y), y))^2+Ntc*Pr*(diff(phi(y), `$`(y, 2)))+beta = 0; eq3 := diff(phi(y), `$`(y, 2))+Nct*(diff(theta(y), `$`(y, 2))) = 0; eq4 := diff(gamma(y), `$`(y, 2))+Nt*(diff(theta(y), `$`(y, 2)))/Nb = 0; bc1 := psi(1) = (1/2)*f, (D(psi))(1)-alpha*((D@@2)(psi))(1) = -1, theta(1) = 0, phi(1) = 0, gamma(1) = 0; bc2 := psi(-1) = -(1/2)*f, (D(psi))(-1)+alpha*((D@@2)(psi))(-1) = -1, theta(-1) = 1, phi(-1) = 1, gamma(-1) = 1; OdeSys := eq1, eq2, eq3, eq4; Cond := bc1, bc2; RdVals := [.1, .8, 1.6, 2.4]; for j to numelems(RdVals) do Ans[j] := dsolve(eval([OdeSys, Cond], Rd = RdVals[j]), numeric, output = listprocedure) end do; cols := [red, blue, black, green]; plotA := display([seq(odeplot(Ans[k], [y, psi(y)], y = -1 .. 1, color = cols[k], thickness = 2), k = 1 .. numelems(RdVals))], axes = boxed, labels = ["y", "&psi;(y)"], title = Typesetting:-mtext("Steady Velocity distribution", color = red), size = [600, 600]); display(plotA)

NULL

Download pulatile_flow_error.mw

Your description is not very clear, but I think the following does what you want.

restart

with(combstruct)

n := 4; k := 2

4

2

Define trees with k branches from each node. Z here is a leaf on the tree.

sys := {Tree = Union(Z, Prod(`$`(Tree, k)))}

{Tree = Union(Z, Prod(Tree, Tree))}

Find all possibilities

all := allstructs([Tree, sys], size = n)

[Prod(Z, Prod(Z, Prod(Z, Z))), Prod(Z, Prod(Prod(Z, Z), Z)), Prod(Prod(Z, Z), Prod(Z, Z)), Prod(Prod(Z, Prod(Z, Z)), Z), Prod(Prod(Prod(Z, Z), Z), Z)]

Convert the Prod(...) to [...]

lists := eval(all, Prod = (proc () options operator, arrow; [args] end proc))

[[Z, [Z, [Z, Z]]], [Z, [[Z, Z], Z]], [[Z, Z], [Z, Z]], [[Z, [Z, Z]], Z], [[[Z, Z], Z], Z]]

The LeafToSymbol routine below then substitutes the a,b,c,d for the Z's

Here is a procedure to carry out the whole thing

Groupings := proc(L::list(symbol), k::posint)
local Tree, Leaf, sys, n, lists, LeafToSymbol;
LeafToSymbol := proc(lst) local S, x;
  S:=String(lst);
  for x in L do
    S := StringTools:-Substitute(S, "Leaf", String(x));
  end do;
  parse(S)
end proc;
if k = 1 then error "k must be greater than 1" end if;
n := nops(L);
sys := {Tree = 'Union'(Leaf, 'Prod'(Tree $ k)), Leaf = 'Atom'};
lists := eval(combstruct['allstructs']([Tree, sys], 'size' = n), 'Prod' = (()->[args]));
map(LeafToSymbol, lists);
end proc:

Groupings([a, b, c, d], 2)

[[a, [b, [c, d]]], [a, [[b, c], d]], [[a, b], [c, d]], [[a, [b, c]], d], [[[a, b], c], d]]

NULL

Download Groupings.mw

On a technical note, there has to be a more elegant way to implement LeafToSymbol that doesn't involve conversion to a string, string proccessing and parse, but I'm out of ideas today. 

Here's one way to look at the matrix (in Maple 2025 there is also a colorbar that doesn't display here).

restart

with(ImageTools); with(LinearAlgebra)

M := (1/255)*RandomMatrix(8, generator = 0 .. 255); G := convert(M, Image); Embed(G)

plots:-matrixplot(M, dimension = 2)

NULL

Download image.mw

For your new question, I believe this is what you want?

Simultaneously_solve.mw

You had an extra 0=0 equation. Not sure that made much difference, but more importantly if you leave out the explicit option, you get back 66 solutions in a quite short time. If they have RootOfs, you can use allvalues on them. If you want to keep option explicit and wait longer, you could try maxsols=200 (or perhaps infinity)

 f-p-.mw

[Edited] The immediate error is just because solve returned NULL. You can find a parametric solution (at least in Maple 2025).

There are very many parameters here. What sort of answer do you want here - many specifications of say 10 different conditiions between parameters that leads to the relation being true? If so you could look more into the parametric solution that Maple provides. Note that many of the cases are for negative parameters and so not of interest. Making assumptions might narrow down the possibilities but the time will likely be too long. A full analysis might also be possible with the tools in the regular chains package.

Otherwise a more manual solution might make some progress, but would need more input about feasible parameter ranges, e.g., you may know that delta<1 or eta>1.

restart

kernelopts(version)

`Maple 2025.1, X86 64 WINDOWS, Jun 12 2025, Build ID 1932578`

ineq := rho*(1-(Pn-Pr)/(1-delta)+eta*(Pn-Pr)/(1-delta)) <= (1/2+(i1-i2)/(2*tau))*(1-(-beta*i1*upsilon+Pr)/delta)-eta*(-beta*i1*upsilon+Pr)/delta

rho*(1-(Pn-Pr)/(1-delta)+eta*(Pn-Pr)/(1-delta)) <= (1/2+(1/2)*(i1-i2)/tau)*(1-(-beta*i1*upsilon+Pr)/delta)-eta*(-beta*i1*upsilon+Pr)/delta

temp := collect(ineq,i1);

rho*(1-(Pn-Pr)/(1-delta)+eta*(Pn-Pr)/(1-delta)) <= (1/2)*beta*upsilon*i1^2/(tau*delta)+((1/2-(1/2)*i2/tau)*beta*upsilon/delta+(1/2)*(1-Pr/delta)/tau+eta*beta*upsilon/delta)*i1+(1/2-(1/2)*i2/tau)*(1-Pr/delta)-eta*Pr/delta

Move the lhs over to the rhs

temp2 := temp-lhs(temp)

0 <= (1/2)*beta*upsilon*i1^2/(tau*delta)+((1/2-(1/2)*i2/tau)*beta*upsilon/delta+(1/2)*(1-Pr/delta)/tau+eta*beta*upsilon/delta)*i1+(1/2-(1/2)*i2/tau)*(1-Pr/delta)-eta*Pr/delta-rho*(1-(Pn-Pr)/(1-delta)+eta*(Pn-Pr)/(1-delta))

It looks as thogh Maple can solve the whole problem, but it will be a nightmare sorting through the various 1368 cases (and the "otherwise" case).

sol := solve(temp2, i1, parametric); length(%); (nops(`%%`)-1)*(1/2)

1586597

1368

A typical condition and result.

case := 520; op(2*case-1, sol); op(2*case, sol)

520

And(delta < 0, 0 < tau, upsilon < 0, 1 < eta, 0 < beta, rho = 0)

[[i1 <= (1/2)*(-2*beta*eta*upsilon*tau+i2*beta*upsilon-beta*upsilon*tau+(4*beta^2*eta^2*upsilon^2*tau^2-4*i2*beta^2*eta*upsilon^2*tau+4*beta^2*eta*upsilon^2*tau^2+i2^2*beta^2*upsilon^2-2*i2*beta^2*upsilon^2*tau+beta^2*upsilon^2*tau^2+4*Pr*beta*eta*upsilon*tau+4*beta*eta*upsilon*tau*delta-2*Pr*i2*beta*upsilon+2*Pr*beta*upsilon*tau+2*i2*beta*upsilon*delta-2*beta*upsilon*tau*delta+Pr^2-2*Pr*delta+delta^2)^(1/2)+Pr-delta)/(beta*upsilon)], [-(1/2)*(2*beta*eta*upsilon*tau-i2*beta*upsilon+beta*upsilon*tau-Pr+delta+(4*beta^2*eta^2*upsilon^2*tau^2-4*i2*beta^2*eta*upsilon^2*tau+4*beta^2*eta*upsilon^2*tau^2+i2^2*beta^2*upsilon^2-2*i2*beta^2*upsilon^2*tau+beta^2*upsilon^2*tau^2+4*Pr*beta*eta*upsilon*tau+4*beta*eta*upsilon*tau*delta-2*Pr*i2*beta*upsilon+2*Pr*beta*upsilon*tau+2*i2*beta*upsilon*delta-2*beta*upsilon*tau*delta+Pr^2-2*Pr*delta+delta^2)^(1/2))/(beta*upsilon) <= i1]]

Let's simplify by collecting the complicated combinations of parameters into simpler parameters

params:={(a,b,c)=~(seq(coeff(rhs(temp2),i1,k),k=2..0,-1))};

{a = (1/2)*beta*upsilon/(tau*delta), b = (1/2-(1/2)*i2/tau)*beta*upsilon/delta+(1/2)*(1-Pr/delta)/tau+eta*beta*upsilon/delta, c = (1/2-(1/2)*i2/tau)*(1-Pr/delta)-eta*Pr/delta-rho*(1-(Pn-Pr)/(1-delta)+eta*(Pn-Pr)/(1-delta))}

So in simpler form we have

temp3 := 0 <= a*i1^2 + b*i1 + c;

0 <= a*i1^2+b*i1+c

solve(temp3, i1, parametric)

piecewise(And(a = 0, b = 0, 0 <= c), [[i1 = i1]], And(a = 0, 0 < b), [[-c/b <= i1]], And(a = 0, b < 0), [[i1 <= -c/b]], And(0 < a, (1/4)*b^2/a <= c), [[i1 = i1]], And(0 < a, c < (1/4)*b^2/a), [[i1 <= -(1/2)*(b+(-4*a*c+b^2)^(1/2))/a], [(1/2)*(-b+(-4*a*c+b^2)^(1/2))/a <= i1]], And(a < 0, (1/4)*b^2/a <= c), [[(1/2)*(-b+(-4*a*c+b^2)^(1/2))/a <= i1, i1 <= -(1/2)*(b+(-4*a*c+b^2)^(1/2))/a]], [])

Aside from the cases with b=0, there are three different cases, depending on the value of d = -4*a*c+b^2, which is just the discriminant of the quadratic a*i1^2+b*i1+c. We want to know the values of i1 for which the parabola is above the i1 axis. Since a is positive, the parabola is not inverted. If d < 0 the roots are complex, and the whole parabola is above the axis. This is case 4. If  d >= 0 the roots are real (part of the parabola is below/on the axis) and for the relation to hold i1 must be greater than the more positive root or less than the more negative root (outside the interval between the roots) - this is case 5. Case 6 is for a<0, which is not of interest.

So we want to find when the discriminant is positive or negative

d := simplify(eval(-4*a*c+b^2, params))

-2*((1/2-(1/2)*i2/tau)*(1-Pr/delta)-eta*Pr/delta-rho*(1-(Pn-Pr)/(1-delta)+eta*(Pn-Pr)/(1-delta)))*beta*upsilon/(tau*delta)+(1/4)*(upsilon*((-2*eta-1)*tau+i2)*beta-delta+Pr)^2/(tau^2*delta^2)

This is going to depend on the exact values of the parameters and is still a complicated problem. But if you know some extra conditions you might be able to narrow it down. For example it seems important to know if delta<1

`assuming`([coulditbe(d >= 0)], [eta > 1, delta < 1, Pn > Pr, delta > 0])

true

So this is progress, but not enough to narrow it down

`assuming`([is(d >= 0)], [eta > 1, delta < 1, Pn > Pr, delta > 0])

false

solve(d = 0)

{Pn = (1/8)*(4*beta^2*delta*eta^2*tau^2*upsilon^2-4*beta^2*delta*eta*i2*tau*upsilon^2+4*beta^2*delta*eta*tau^2*upsilon^2-4*beta^2*eta^2*tau^2*upsilon^2+8*Pr*beta*delta*eta*rho*tau*upsilon+beta^2*delta*i2^2*upsilon^2-2*beta^2*delta*i2*tau*upsilon^2+beta^2*delta*tau^2*upsilon^2+4*beta^2*eta*i2*tau*upsilon^2-4*beta^2*eta*tau^2*upsilon^2+4*Pr*beta*delta*eta*tau*upsilon-8*Pr*beta*delta*rho*tau*upsilon-beta^2*i2^2*upsilon^2+2*beta^2*i2*tau*upsilon^2-beta^2*tau^2*upsilon^2+4*beta*delta^2*eta*tau*upsilon+8*beta*delta^2*rho*tau*upsilon-2*Pr*beta*delta*i2*upsilon+2*Pr*beta*delta*tau*upsilon-4*Pr*beta*eta*tau*upsilon+2*beta*delta^2*i2*upsilon-2*beta*delta^2*tau*upsilon-4*beta*delta*eta*tau*upsilon-8*beta*delta*rho*tau*upsilon+2*Pr*beta*i2*upsilon-2*Pr*beta*tau*upsilon-2*beta*delta*i2*upsilon+2*beta*delta*tau*upsilon+Pr^2*delta-2*Pr*delta^2+delta^3-Pr^2+2*Pr*delta-delta^2)/(rho*beta*upsilon*tau*delta*(eta-1)), Pr = Pr, beta = beta, delta = delta, eta = eta, i2 = i2, rho = rho, tau = tau, upsilon = upsilon}

NULL

Download Question_Isolate_i1.mw

restart

eq1 := diff(r(t), t)+1+cos(`&varphi;`(t)) = 0; eq2 := diff(`&varphi;`(t), t)+1-sin(`&varphi;`(t))/r(t) = 0

diff(r(t), t)+1+cos(varphi(t)) = 0

diff(varphi(t), t)+1-sin(varphi(t))/r(t) = 0

NULL

ics := r(0) = 2.0, `&varphi;`(0) = Pi/(1.5)

r(0) = 2.0, varphi(0) = 2.094395103

Unless you know you will always be using a particular range, I would not put a range here. If there is no range, then the range and values are determined when you actually need them, in this case in odeplot. The range option here doesn't apply to all methods. On the other hand if you do use range here, you can use refine = 2 in odeplot to get twice the normal number of points.

soln := dsolve({eq1, eq2, ics}, {r(t), `&varphi;`(t)}, numeric)

proc (x_rkf45) local _res, _dat, _vars, _solnproc, _xout, _ndsol, _pars, _n, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 < nargs then error "invalid input: too many arguments" end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x_rkf45) else _xout := evalf(x_rkf45) end if; _dat := Array(1..4, {(1) = proc (_x_in) local _x_out, _dtbl, _dat, _vmap, _x0, _y0, _val, _digits, _neq, _nevar, _ndisc, _nevt, _pars, _ini, _par, _i, _j, _k, _src, _t1; option `Copyright (c) 2002 by Waterloo Maple Inc. All rights reserved.`; table( [( "complex" ) = false ] ) _x_out := _x_in; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 28, [( 1 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 2 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 3 ) = ([0, 0, 0, Array(1..0, 1..2, {}, datatype = float[8], order = C_order)]), ( 4 ) = (Array(1..65, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0, (50) = 50, (51) = 1, (52) = 0, (53) = 0, (54) = 0, (55) = 0, (56) = 0, (57) = 0, (58) = 0, (59) = 10000, (60) = 0, (61) = 1000, (62) = 0, (63) = 0, (64) = -1, (65) = 0}, datatype = integer[8])), ( 5 ) = (Array(1..28, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = .19535812688284548, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .49999999999999, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = 0.10e-14, (26) = .0, (27) = .0, (28) = .0}, datatype = float[8], order = C_order)), ( 6 ) = (Array(1..2, {(1) = 2.0, (2) = 2.094395103}, datatype = float[8], order = C_order)), ( 7 ) = ([Array(1..4, 1..7, {(1, 1) = .0, (1, 2) = .203125, (1, 3) = .3046875, (1, 4) = .75, (1, 5) = .8125, (1, 6) = .40625, (1, 7) = .8125, (2, 1) = 0.6378173828125e-1, (2, 2) = .0, (2, 3) = .279296875, (2, 4) = .27237892150878906, (2, 5) = -0.9686851501464844e-1, (2, 6) = 0.1956939697265625e-1, (2, 7) = .5381584167480469, (3, 1) = 0.31890869140625e-1, (3, 2) = .0, (3, 3) = -.34375, (3, 4) = -.335235595703125, (3, 5) = .2296142578125, (3, 6) = .41748046875, (3, 7) = 11.480712890625, (4, 1) = 0.9710520505905151e-1, (4, 2) = .0, (4, 3) = .40350341796875, (4, 4) = 0.20297467708587646e-1, (4, 5) = -0.6054282188415527e-2, (4, 6) = -0.4770040512084961e-1, (4, 7) = .77858567237854}, datatype = float[8], order = C_order), Array(1..6, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = 1.0, (2, 1) = .25, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = 1.0, (3, 1) = .1875, (3, 2) = .5625, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = 2.0, (4, 1) = .23583984375, (4, 2) = -.87890625, (4, 3) = .890625, (4, 4) = .0, (4, 5) = .0, (4, 6) = .2681884765625, (5, 1) = .1272735595703125, (5, 2) = -.5009765625, (5, 3) = .44921875, (5, 4) = -0.128936767578125e-1, (5, 5) = .0, (5, 6) = 0.626220703125e-1, (6, 1) = -0.927734375e-1, (6, 2) = .626220703125, (6, 3) = -.4326171875, (6, 4) = .1418304443359375, (6, 5) = -0.861053466796875e-1, (6, 6) = .3131103515625}, datatype = float[8], order = C_order), Array(1..6, {(1) = .0, (2) = .386, (3) = .21, (4) = .63, (5) = 1.0, (6) = 1.0}, datatype = float[8], order = C_order), Array(1..6, {(1) = .25, (2) = -.1043, (3) = .1035, (4) = -0.362e-1, (5) = .0, (6) = .0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 1.544, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = .9466785280815533, (3, 2) = .25570116989825814, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = 3.3148251870684886, (4, 2) = 2.896124015972123, (4, 3) = .9986419139977808, (4, 4) = .0, (4, 5) = .0, (5, 1) = 1.2212245092262748, (5, 2) = 6.019134481287752, (5, 3) = 12.537083329320874, (5, 4) = -.687886036105895, (5, 5) = .0, (6, 1) = 1.2212245092262748, (6, 2) = 6.019134481287752, (6, 3) = 12.537083329320874, (6, 4) = -.687886036105895, (6, 5) = 1.0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = -5.6688, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = -2.4300933568337584, (3, 2) = -.20635991570891224, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = -.10735290581452621, (4, 2) = -9.594562251021896, (4, 3) = -20.470286148096154, (4, 4) = .0, (4, 5) = .0, (5, 1) = 7.496443313968615, (5, 2) = -10.246804314641219, (5, 3) = -33.99990352819906, (5, 4) = 11.708908932061595, (5, 5) = .0, (6, 1) = 8.083246795922411, (6, 2) = -7.981132988062785, (6, 3) = -31.52159432874373, (6, 4) = 16.319305431231363, (6, 5) = -6.0588182388340535}, datatype = float[8], order = C_order), Array(1..3, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 10.126235083446911, (2, 2) = -7.487995877607633, (2, 3) = -34.800918615557414, (2, 4) = -7.9927717075687275, (2, 5) = 1.0251377232956207, (3, 1) = -.6762803392806898, (3, 2) = 6.087714651678606, (3, 3) = 16.43084320892463, (3, 4) = 24.767225114183653, (3, 5) = -6.5943891257167815}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[8]), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..4, {(1) = .0, (2) = .0, (3) = .0, (4) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[8])]), ( 8 ) = ([Array(1..2, {(1) = 2.0, (2) = 2.094395103}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = -.4999999994744918, (2) = -.5669872982594819}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = r(t), Y[2] = varphi(t)]`; YP[1] := -1-cos(Y[2]); YP[2] := -1+sin(Y[2])/Y[1]; 0 end proc, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rkf45"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([0, 0, 0, 0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = r(t), Y[2] = varphi(t)]`; YP[1] := -1-cos(Y[2]); YP[2] := -1+sin(Y[2])/Y[1]; 0 end proc, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 27 ) = (""), ( 26 ) = (Array(1..0, {})), ( 25 ) = (Array(1..0, {})), ( 24 ) = (0), ( 28 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 2.0}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _x0 := _dtbl[1][5][5]; _neq := _dtbl[1][4][1]; _nevar := _dtbl[1][4][3]; _ndisc := _dtbl[1][4][4]; _nevt := _dtbl[1][4][16]; if not type(_x_out, 'numeric') then if member(_x_out, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _x_out = "left" then if type(_dtbl[2], 'array') then return _dtbl[2][5][1] end if elif _x_out = "right" then if type(_dtbl[3], 'array') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _x_out = "method" then return _dtbl[1][15] elif _x_out = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _x_out = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _x_out = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _x_out = "enginedata" then return _dtbl[1] elif _x_out = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _x_out = "initial" then return procname(_y0[0]) elif _x_out = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _x_out = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _x_out = "parameters" then return [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] elif _x_out = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] elif _x_out = "last" then if _dtbl[4] <> 2 and _dtbl[4] <> 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error "no information is available on last computed point" else _x_out := _dtbl[_dtbl[4]][5][1] end if elif _x_out = "function" then if _dtbl[1][4][33]-2. = 0 then return eval(_dtbl[1][10], 1) else return eval(_dtbl[1][10][1], 1) end if elif _x_out = "map" then return copy(_vmap) elif type(_x_in, `=`) and type(rhs(_x_in), 'list') and member(lhs(_x_in), {"initial", "parameters", "initial_and_parameters"}) then _ini, _par := [], []; if lhs(_x_in) = "initial" then _ini := rhs(_x_in) elif lhs(_x_in) = "parameters" then _par := rhs(_x_in) elif select(type, rhs(_x_in), `=`) <> [] then _par, _ini := selectremove(type, rhs(_x_in), `=`) elif nops(rhs(_x_in)) < nops(_pars)+1 then error "insufficient data for specification of initial and parameters" else _par := rhs(_x_in)[-nops(_pars) .. -1]; _ini := rhs(_x_in)[1 .. -nops(_pars)-1] end if; _x_out := lhs(_x_out); _i := false; if _par <> [] then _i := `dsolve/numeric/process_parameters`(_neq, _pars, _par, _y0) end if; if _ini <> [] then _i := `dsolve/numeric/process_initial`(_neq-_nevar, _ini, _y0, _pars, _vmap) or _i end if; if _i then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _neq, procname, _pars); if _Env_smart_dsolve_numeric = true and type(_y0[0], 'numeric') and _dtbl[1][4][10] <> 1 then procname("right") := _y0[0]; procname("left") := _y0[0] end if end if; if _x_out = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _neq-_nevar)] elif _x_out = "parameters" then return [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _neq-_nevar)], [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] end if elif _x_in = "eventstop" then if _nevt = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 <= _dtbl[5-_i][4][9] then _i := 5-_i; _dtbl[4] := _i; _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) elif 100 <= _dtbl[_i][4][9] then _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) else return 0 end if elif _x_in = "eventstatus" then if _nevt = 0 then error "this solution has no events" end if; _i := [selectremove(proc (a) options operator, arrow; _dtbl[1][3][1][a, 7] = 1 end proc, {seq(_j, _j = 1 .. round(_dtbl[1][3][1][_nevt+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _x_in = "eventclear" then if _nevt = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then error "no events to clear" end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 < _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] < 100 then error "no events to clear" elif _nevt < _dtbl[_i][4][9]-100 then error "event error condition cannot be cleared" else _j := _dtbl[_i][4][9]-100; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error "retriggerable events cannot be cleared" end if; _j := round(_dtbl[_i][3][1][_j, 1]); for _k to _nevt do if _dtbl[_i][3][1][_k, 1] = _j then if _dtbl[_i][3][1][_k, 2] = 3 then error "range events cannot be cleared" end if; _dtbl[_i][3][1][_k, 8] := _dtbl[_i][3][1][_nevt+1, 8] end if end do; _dtbl[_i][4][17] := 0; _dtbl[_i][4][9] := 0; if _dtbl[1][4][10] = 1 then if _i = 2 then try procname(procname("left")) catch:  end try else try procname(procname("right")) catch:  end try end if end if end if; return  elif type(_x_in, `=`) and member(lhs(_x_in), {"eventdisable", "eventenable"}) then if _nevt = 0 then error "this solution has no events" end if; if type(rhs(_x_in), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_x_in))} elif type(rhs(_x_in), 'posint') then _i := {rhs(_x_in)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nevt+1, 1]) end if; if select(proc (a) options operator, arrow; _nevt < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nevt+1, 1]) end if; _k := {}; for _j to _nevt do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_x_in) = "eventdisable" then _dtbl[4] := 0; _j := [evalb(assigned(_dtbl[2]) and member(_dtbl[2][4][17], _i)), evalb(assigned(_dtbl[3]) and member(_dtbl[3][4][17], _i))]; for _k in _i do _dtbl[1][3][1][_k, 7] := 0; if assigned(_dtbl[2]) then _dtbl[2][3][1][_k, 7] := 0 end if; if assigned(_dtbl[3]) then _dtbl[3][3][1][_k, 7] := 0 end if end do; if _j[1] then for _k to _nevt+1 do if _k <= _nevt and not type(_dtbl[2][3][4][_k, 1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to defined init `, _dtbl[2][3][4][_k, 1]); _dtbl[2][3][1][_k, 8] := _dtbl[2][3][4][_k, 1] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to rate hysteresis init `, _dtbl[2][5][24]); _dtbl[2][3][1][_k, 8] := _dtbl[2][5][24] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to initial init `, _x0); _dtbl[2][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to fireinitial init `, _x0-1); _dtbl[2][3][1][_k, 8] := _x0-1 end if end do; _dtbl[2][4][17] := 0; _dtbl[2][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("left")) end if end if; if _j[2] then for _k to _nevt+1 do if _k <= _nevt and not type(_dtbl[3][3][4][_k, 2], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to defined init `, _dtbl[3][3][4][_k, 2]); _dtbl[3][3][1][_k, 8] := _dtbl[3][3][4][_k, 2] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to rate hysteresis init `, _dtbl[3][5][24]); _dtbl[3][3][1][_k, 8] := _dtbl[3][5][24] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to initial init `, _x0); _dtbl[3][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to fireinitial init `, _x0+1); _dtbl[3][3][1][_k, 8] := _x0+1 end if end do; _dtbl[3][4][17] := 0; _dtbl[3][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("right")) end if end if else for _k in _i do _dtbl[1][3][1][_k, 7] := 1 end do; _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); _dtbl[4] := 0; if _dtbl[1][4][10] = 1 then if _x0 <= procname("right") then try procname(procname("right")) catch:  end try end if; if procname("left") <= _x0 then try procname(procname("left")) catch:  end try end if end if end if; return  elif type(_x_in, `=`) and lhs(_x_in) = "eventfired" then if not type(rhs(_x_in), 'list') then error "'eventfired' must be specified as a list" end if; if _nevt = 0 then error "this solution has no events" end if; if _dtbl[4] <> 2 and _dtbl[4] <> 3 then error "'direction' must be set prior to calling/setting 'eventfired'" end if; _i := _dtbl[4]; _val := NULL; if not assigned(_EnvEventRetriggerWarned) then _EnvEventRetriggerWarned := false end if; for _k in rhs(_x_in) do if type(_k, 'integer') then _src := _k elif type(_k, 'integer' = 'anything') and type(evalf(rhs(_k)), 'numeric') then _k := lhs(_k) = evalf[max(Digits, 18)](rhs(_k)); _src := lhs(_k) else error "'eventfired' entry is not valid: %1", _k end if; if _src < 1 or round(_dtbl[1][3][1][_nevt+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nevt+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nevt)}; if nops(_src) <> 1 then error "'eventfired' can only be set/queried for root-finding events and time/interval events" end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] <> 0. and _dtbl[1][3][1][_src, 2]-2. <> 0. then error "'eventfired' can only be set/queried for root-finding events and time/interval events" elif irem(round(_dtbl[1][3][1][_src, 4]), 2) = 1 then if _EnvEventRetriggerWarned = false then WARNING(`'eventfired' has no effect on events that retrigger`) end if; _EnvEventRetriggerWarned := true end if; if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then _val := _val, undefined elif type(_dtbl[_i][3][4][_src, _i-1], 'undefined') or _i = 2 and _dtbl[2][3][1][_src, 8] < _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] < _dtbl[3][3][1][_src, 8] then _val := _val, _dtbl[_i][3][1][_src, 8] else _val := _val, _dtbl[_i][3][4][_src, _i-1] end if; if type(_k, `=`) then if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then error "cannot set event code for a rate hysteresis event" end if; userinfo(3, {'events', 'eventreset'}, `manual set event code `, _src, ` to value `, rhs(_k)); _dtbl[_i][3][1][_src, 8] := rhs(_k); _dtbl[_i][3][4][_src, _i-1] := rhs(_k) end if end do; return [_val] elif type(_x_in, `=`) and lhs(_x_in) = "direction" then if not member(rhs(_x_in), {-1, 1, ':-left', ':-right'}) then error "'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)" end if; _src := `if`(_dtbl[4] = 2, -1, `if`(_dtbl[4] = 3, 1, undefined)); _i := `if`(member(rhs(_x_in), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nevt then for _j to _nevt+1 do if _j <= _nevt and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if; return _src elif _x_in = "eventcount" then if _dtbl[1][3][1] = 0 or _dtbl[4] <> 2 and _dtbl[4] <> 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nevt+1, 12]) end if elif type(_x_in, `=`) and lhs(_x_in) = "setdatacallback" then if not type(rhs(_x_in), 'nonegint') then error "data callback must be a nonnegative integer (address)" end if; _dtbl[1][28] := rhs(_x_in) elif type(_x_in, `=`) and lhs(_x_in) = "Array" then _i := rhs(_x_in); if not type(_i, 'list') or nops(_i) <> 2 or not type(_i[1], 'numeric') or not type(_i[2], 'posint') or _i[2] < 2 then error "Array output must be specified as [end time, min number of points]" end if; _src := array(1 .. 1, [`dsolve/numeric/SC/IVPdcopy`(_dtbl[1])]); if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_src[1][14]), _pars, _neq, _y0) then `dsolve/numeric/SC/reinitialize`(_src, _y0, _neq, procname, _pars, 1) end if end if; if _src[1][4][7] = 0 then error "parameters must be initialized before solution can be computed" end if; _val := `dsolve/numeric/SC/IVPvalues`(_src[1], _x0 .. _i[1], _i[2], _i[2], []); if _val[3] <> "" then `dsolve/numeric/warning`(cat(`requested integration incomplete, received error:`, convert(_val[3], 'symbol'))) end if; _t1 := Array(1 .. _val[2], 0 .. _neq-_nevar+nops(_pars)); _t1[() .. (), 0] := _val[1][1 .. _val[2], 0]; for _i to _neq-_nevar do _t1[() .. (), _i] := _val[1][1 .. _val[2], _vmap[_i]] end do; for _i to nops(_pars) do _t1[() .. (), _neq-_nevar+_i] := _val[1][1 .. _val[2], _neq+_i] end do; return _t1 else return "procname" end if end if; if _x_out = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _neq-_nevar)] end if; _i := `if`(_x0 <= _x_out, 3, 2); if _x_in = "last" and 0 < _dtbl[_i][4][9] and _dtbl[_i][4][9] < 100 then _dat := eval(_dtbl[_i], 2); _j := _dat[4][20]; return [_dat[11][_j, 0], seq(_dat[11][_j, _vmap[_i]], _i = 1 .. _neq-_nevar-_ndisc), seq(_dat[8][1][_vmap[_i]], _i = _neq-_nevar-_ndisc+1 .. _neq-_nevar)] end if; if not type(_dtbl[_i], 'array') then _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nevt then for _j to _nevt+1 do if _j <= _nevt and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if end if; if _x_in <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _neq, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _neq, procname, _pars, _i) end if end if; if _dtbl[1][4][7] = 0 then error "parameters must be initialized before solution can be computed" end if end if; _dat := eval(_dtbl[_i], 2); _dtbl[4] := _i; try _src := `dsolve/numeric/SC/IVPrun`(_dat, _x_out) catch: userinfo(2, `dsolve/debug`, print(`Exception in solnproc:`, [lastexception][2 .. -1])); error  end try; if _dat[17] <> _dtbl[1][17] then _dtbl[1][17] := _dat[17]; _dtbl[1][10] := _dat[10] end if; if _src = 0 and 100 < _dat[4][9] then _val := _dat[3][1][_nevt+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src <> 0 or _dat[4][9] <= 0 then _dtbl[1][5][1] := _x_out else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _x_out then Rounding := -infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further right of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further right of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further right of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nevt+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nevt+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further right of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _x_out := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _x_out < _val then Rounding := infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further left of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further left of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further left of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nevt+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nevt+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further left of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _x_out := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _digits := _dat[4][26]; if type(_EnvDSNumericSaveDigits, 'posint') then _dat[4][26] := _EnvDSNumericSaveDigits else _dat[4][26] := Digits end if; _Env_dsolve_SC_native := true; if _dat[4][25] = 1 then _i := 1; _dat[4][25] := 2 else _i := _dat[4][25] end if; _val := `dsolve/numeric/SC/IVPval`(_dat, _x_out, _src); _dat[4][25] := _i; _dat[4][26] := _digits; [_x_out, seq(_val[_vmap[_i]], _i = 1 .. _neq-_nevar)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _x_out, _src); [_x_out, seq(_val[_vmap[_i]], _i = 1 .. _neq-_nevar)] end if end proc, (2) = Array(0..0, {}), (3) = [t, r(t), varphi(t)], (4) = []}); _vars := _dat[3]; _pars := map(lhs, _dat[4]); _n := nops(_vars)-1; _solnproc := _dat[1]; if not type(_xout, 'numeric') then if member(x_rkf45, ["start", 'start', "method", 'method', "left", 'left', "right", 'right', "leftdata", "rightdata", "enginedata", "eventstop", 'eventstop', "eventclear", 'eventclear', "eventstatus", 'eventstatus', "eventcount", 'eventcount', "laxtol", 'laxtol', "numfun", 'numfun', NULL]) then _res := _solnproc(convert(x_rkf45, 'string')); if 1 < nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res <> "procname" then return _res end if elif member(x_rkf45, ["last", 'last', "initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(x_rkf45, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(x_rkf45), 'string') = rhs(x_rkf45); if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else error "initial and/or parameter values must be specified in a list" end if; if lhs(_xout) = "initial" then return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["eventdisable", 'eventdisable', "eventenable", 'eventenable', "eventfired", 'eventfired', "direction", 'direction', "Array", 'Array', NULL]) then return _solnproc(convert(lhs(x_rkf45), 'string') = rhs(x_rkf45)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _vars elif _xout = "Array" then return [op(_vars), op(_pars)] end if; if procname <> unknown then return ('procname')(x_rkf45) else _ndsol := 1; _ndsol := _ndsol; _ndsol := pointto(_dat[2][0]); return ('_ndsol')(x_rkf45) end if end if; try _res := _solnproc(_xout); [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] catch: error  end try end proc

rkf45 is an automatic step size method (not the standard fixed stepsize Runge-Kutta method), so gives the default accuracy over all points plotted, with a reasonable number of points. I would specify the range here.

plots[odeplot](soln, [[t, r(t)], [t, `&varphi;`(t)]], 0 .. 3, color = [red, blue])

The 0..3 solution is stored so when we do 0..30, the solver starts actually starts from 3.

plots[odeplot](soln, [[t, r(t)], [t, `&varphi;`(t)]], 0 .. 30, color = [red, blue])

Look at a small section of the solution

plots[odeplot](soln, [[t, r(t)], [t, `&varphi;`(t)]], 1.25 .. 1.4, color = [red, blue], view = [default, 1.63 .. 1.65])

Use another method. rosenbrock is default for stiff equations, and can be obtained by stiff=true or method=rosenbrock

soln := dsolve({eq1, eq2, ics}, {r(t), `&varphi;`(t)}, numeric, stiff = true)

proc (x_rosenbrock) local _res, _dat, _vars, _solnproc, _xout, _ndsol, _pars, _n, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 < nargs then error "invalid input: too many arguments" end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x_rosenbrock) else _xout := evalf(x_rosenbrock) end if; _dat := Array(1..4, {(1) = proc (_x_in) local _x_out, _dtbl, _dat, _vmap, _x0, _y0, _val, _digits, _neq, _nevar, _ndisc, _nevt, _pars, _ini, _par, _i, _j, _k, _src, _t1; option `Copyright (c) 2002 by Waterloo Maple Inc. All rights reserved.`; table( [( "complex" ) = false ] ) _x_out := _x_in; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 28, [( 1 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 2 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 3 ) = ([0, 0, 0, Array(1..0, 1..2, {}, datatype = float[8], order = C_order)]), ( 4 ) = (Array(1..65, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 2, (23) = 3, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 2, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0, (50) = 50, (51) = 1, (52) = 0, (53) = 0, (54) = 0, (55) = 0, (56) = 0, (57) = 0, (58) = 0, (59) = 10000, (60) = 0, (61) = 1000, (62) = 0, (63) = 0, (64) = -1, (65) = 0}, datatype = integer[8])), ( 5 ) = (Array(1..28, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = 0.8843285200840989e-1, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .49999999999999, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = 0.10e-14, (26) = .0, (27) = .0, (28) = .0}, datatype = float[8], order = C_order)), ( 6 ) = (Array(1..2, {(1) = 2.0, (2) = 2.094395103}, datatype = float[8], order = C_order)), ( 7 ) = ([Array(1..4, 1..7, {(1, 1) = .0, (1, 2) = .203125, (1, 3) = .3046875, (1, 4) = .75, (1, 5) = .8125, (1, 6) = .40625, (1, 7) = .8125, (2, 1) = 0.6378173828125e-1, (2, 2) = .0, (2, 3) = .279296875, (2, 4) = .27237892150878906, (2, 5) = -0.9686851501464844e-1, (2, 6) = 0.1956939697265625e-1, (2, 7) = .5381584167480469, (3, 1) = 0.31890869140625e-1, (3, 2) = .0, (3, 3) = -.34375, (3, 4) = -.335235595703125, (3, 5) = .2296142578125, (3, 6) = .41748046875, (3, 7) = 11.480712890625, (4, 1) = 0.9710520505905151e-1, (4, 2) = .0, (4, 3) = .40350341796875, (4, 4) = 0.20297467708587646e-1, (4, 5) = -0.6054282188415527e-2, (4, 6) = -0.4770040512084961e-1, (4, 7) = .77858567237854}, datatype = float[8], order = C_order), Array(1..6, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = 1.0, (2, 1) = .25, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = 1.0, (3, 1) = .1875, (3, 2) = .5625, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = 2.0, (4, 1) = .23583984375, (4, 2) = -.87890625, (4, 3) = .890625, (4, 4) = .0, (4, 5) = .0, (4, 6) = .2681884765625, (5, 1) = .1272735595703125, (5, 2) = -.5009765625, (5, 3) = .44921875, (5, 4) = -0.128936767578125e-1, (5, 5) = .0, (5, 6) = 0.626220703125e-1, (6, 1) = -0.927734375e-1, (6, 2) = .626220703125, (6, 3) = -.4326171875, (6, 4) = .1418304443359375, (6, 5) = -0.861053466796875e-1, (6, 6) = .3131103515625}, datatype = float[8], order = C_order), Array(1..6, {(1) = .0, (2) = .386, (3) = .21, (4) = .63, (5) = 1.0, (6) = 1.0}, datatype = float[8], order = C_order), Array(1..6, {(1) = .25, (2) = -.1043, (3) = .1035, (4) = -0.362e-1, (5) = .0, (6) = .0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 1.544, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = .9466785280815533, (3, 2) = .25570116989825814, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = 3.3148251870684886, (4, 2) = 2.896124015972123, (4, 3) = .9986419139977808, (4, 4) = .0, (4, 5) = .0, (5, 1) = 1.2212245092262748, (5, 2) = 6.019134481287752, (5, 3) = 12.537083329320874, (5, 4) = -.687886036105895, (5, 5) = .0, (6, 1) = 1.2212245092262748, (6, 2) = 6.019134481287752, (6, 3) = 12.537083329320874, (6, 4) = -.687886036105895, (6, 5) = 1.0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = -5.6688, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = -2.4300933568337584, (3, 2) = -.20635991570891224, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = -.10735290581452621, (4, 2) = -9.594562251021896, (4, 3) = -20.470286148096154, (4, 4) = .0, (4, 5) = .0, (5, 1) = 7.496443313968615, (5, 2) = -10.246804314641219, (5, 3) = -33.99990352819906, (5, 4) = 11.708908932061595, (5, 5) = .0, (6, 1) = 8.083246795922411, (6, 2) = -7.981132988062785, (6, 3) = -31.52159432874373, (6, 4) = 16.319305431231363, (6, 5) = -6.0588182388340535}, datatype = float[8], order = C_order), Array(1..3, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 10.126235083446911, (2, 2) = -7.487995877607633, (2, 3) = -34.800918615557414, (2, 4) = -7.9927717075687275, (2, 5) = 1.0251377232956207, (3, 1) = -.6762803392806898, (3, 2) = 6.087714651678606, (3, 3) = 16.43084320892463, (3, 4) = 24.767225114183653, (3, 5) = -6.5943891257167815}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = 1.0, (2) = 1.0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .8660254034810363, (2, 1) = -.21650635087025907, (2, 2) = -.2500000002627541}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[8]), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..4, {(1) = .0, (2) = .0, (3) = .0, (4) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[8])]), ( 8 ) = ([Array(1..2, {(1) = 2.0, (2) = 2.094395103}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = -.4910254037437905, (2) = .24805694306301246}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = r(t), Y[2] = varphi(t)]`; YP[1] := -1-cos(Y[2]); YP[2] := -1+sin(Y[2])/Y[1]; 0 end proc, proc (X, Y, FX, FY) FX[1 .. 2] := 0; FY[1 .. 2, 1 .. 2] := 0; FY[2, 1] := -sin(Y[2])/Y[1]^2; FY[1, 2] := sin(Y[2]); FY[2, 2] := cos(Y[2])/Y[1]; 0 end proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rosenbrock"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([0, 0, 0, 0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = r(t), Y[2] = varphi(t)]`; YP[1] := -1-cos(Y[2]); YP[2] := -1+sin(Y[2])/Y[1]; 0 end proc, proc (X, Y, FX, FY) FX[1 .. 2] := 0; FY[1 .. 2, 1 .. 2] := 0; FY[2, 1] := -sin(Y[2])/Y[1]^2; FY[1, 2] := sin(Y[2]); FY[2, 2] := cos(Y[2])/Y[1]; 0 end proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 27 ) = (""), ( 26 ) = (Array(1..0, {})), ( 25 ) = (Array(1..0, {})), ( 24 ) = (0), ( 28 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 2.0}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _x0 := _dtbl[1][5][5]; _neq := _dtbl[1][4][1]; _nevar := _dtbl[1][4][3]; _ndisc := _dtbl[1][4][4]; _nevt := _dtbl[1][4][16]; if not type(_x_out, 'numeric') then if member(_x_out, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _x_out = "left" then if type(_dtbl[2], 'array') then return _dtbl[2][5][1] end if elif _x_out = "right" then if type(_dtbl[3], 'array') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _x_out = "method" then return _dtbl[1][15] elif _x_out = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _x_out = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _x_out = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _x_out = "enginedata" then return _dtbl[1] elif _x_out = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _x_out = "initial" then return procname(_y0[0]) elif _x_out = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _x_out = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _x_out = "parameters" then return [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] elif _x_out = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] elif _x_out = "last" then if _dtbl[4] <> 2 and _dtbl[4] <> 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error "no information is available on last computed point" else _x_out := _dtbl[_dtbl[4]][5][1] end if elif _x_out = "function" then if _dtbl[1][4][33]-2. = 0 then return eval(_dtbl[1][10], 1) else return eval(_dtbl[1][10][1], 1) end if elif _x_out = "map" then return copy(_vmap) elif type(_x_in, `=`) and type(rhs(_x_in), 'list') and member(lhs(_x_in), {"initial", "parameters", "initial_and_parameters"}) then _ini, _par := [], []; if lhs(_x_in) = "initial" then _ini := rhs(_x_in) elif lhs(_x_in) = "parameters" then _par := rhs(_x_in) elif select(type, rhs(_x_in), `=`) <> [] then _par, _ini := selectremove(type, rhs(_x_in), `=`) elif nops(rhs(_x_in)) < nops(_pars)+1 then error "insufficient data for specification of initial and parameters" else _par := rhs(_x_in)[-nops(_pars) .. -1]; _ini := rhs(_x_in)[1 .. -nops(_pars)-1] end if; _x_out := lhs(_x_out); _i := false; if _par <> [] then _i := `dsolve/numeric/process_parameters`(_neq, _pars, _par, _y0) end if; if _ini <> [] then _i := `dsolve/numeric/process_initial`(_neq-_nevar, _ini, _y0, _pars, _vmap) or _i end if; if _i then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _neq, procname, _pars); if _Env_smart_dsolve_numeric = true and type(_y0[0], 'numeric') and _dtbl[1][4][10] <> 1 then procname("right") := _y0[0]; procname("left") := _y0[0] end if end if; if _x_out = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _neq-_nevar)] elif _x_out = "parameters" then return [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _neq-_nevar)], [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] end if elif _x_in = "eventstop" then if _nevt = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 <= _dtbl[5-_i][4][9] then _i := 5-_i; _dtbl[4] := _i; _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) elif 100 <= _dtbl[_i][4][9] then _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) else return 0 end if elif _x_in = "eventstatus" then if _nevt = 0 then error "this solution has no events" end if; _i := [selectremove(proc (a) options operator, arrow; _dtbl[1][3][1][a, 7] = 1 end proc, {seq(_j, _j = 1 .. round(_dtbl[1][3][1][_nevt+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _x_in = "eventclear" then if _nevt = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then error "no events to clear" end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 < _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] < 100 then error "no events to clear" elif _nevt < _dtbl[_i][4][9]-100 then error "event error condition cannot be cleared" else _j := _dtbl[_i][4][9]-100; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error "retriggerable events cannot be cleared" end if; _j := round(_dtbl[_i][3][1][_j, 1]); for _k to _nevt do if _dtbl[_i][3][1][_k, 1] = _j then if _dtbl[_i][3][1][_k, 2] = 3 then error "range events cannot be cleared" end if; _dtbl[_i][3][1][_k, 8] := _dtbl[_i][3][1][_nevt+1, 8] end if end do; _dtbl[_i][4][17] := 0; _dtbl[_i][4][9] := 0; if _dtbl[1][4][10] = 1 then if _i = 2 then try procname(procname("left")) catch:  end try else try procname(procname("right")) catch:  end try end if end if end if; return  elif type(_x_in, `=`) and member(lhs(_x_in), {"eventdisable", "eventenable"}) then if _nevt = 0 then error "this solution has no events" end if; if type(rhs(_x_in), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_x_in))} elif type(rhs(_x_in), 'posint') then _i := {rhs(_x_in)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nevt+1, 1]) end if; if select(proc (a) options operator, arrow; _nevt < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nevt+1, 1]) end if; _k := {}; for _j to _nevt do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_x_in) = "eventdisable" then _dtbl[4] := 0; _j := [evalb(assigned(_dtbl[2]) and member(_dtbl[2][4][17], _i)), evalb(assigned(_dtbl[3]) and member(_dtbl[3][4][17], _i))]; for _k in _i do _dtbl[1][3][1][_k, 7] := 0; if assigned(_dtbl[2]) then _dtbl[2][3][1][_k, 7] := 0 end if; if assigned(_dtbl[3]) then _dtbl[3][3][1][_k, 7] := 0 end if end do; if _j[1] then for _k to _nevt+1 do if _k <= _nevt and not type(_dtbl[2][3][4][_k, 1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to defined init `, _dtbl[2][3][4][_k, 1]); _dtbl[2][3][1][_k, 8] := _dtbl[2][3][4][_k, 1] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to rate hysteresis init `, _dtbl[2][5][24]); _dtbl[2][3][1][_k, 8] := _dtbl[2][5][24] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to initial init `, _x0); _dtbl[2][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to fireinitial init `, _x0-1); _dtbl[2][3][1][_k, 8] := _x0-1 end if end do; _dtbl[2][4][17] := 0; _dtbl[2][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("left")) end if end if; if _j[2] then for _k to _nevt+1 do if _k <= _nevt and not type(_dtbl[3][3][4][_k, 2], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to defined init `, _dtbl[3][3][4][_k, 2]); _dtbl[3][3][1][_k, 8] := _dtbl[3][3][4][_k, 2] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to rate hysteresis init `, _dtbl[3][5][24]); _dtbl[3][3][1][_k, 8] := _dtbl[3][5][24] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to initial init `, _x0); _dtbl[3][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to fireinitial init `, _x0+1); _dtbl[3][3][1][_k, 8] := _x0+1 end if end do; _dtbl[3][4][17] := 0; _dtbl[3][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("right")) end if end if else for _k in _i do _dtbl[1][3][1][_k, 7] := 1 end do; _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); _dtbl[4] := 0; if _dtbl[1][4][10] = 1 then if _x0 <= procname("right") then try procname(procname("right")) catch:  end try end if; if procname("left") <= _x0 then try procname(procname("left")) catch:  end try end if end if end if; return  elif type(_x_in, `=`) and lhs(_x_in) = "eventfired" then if not type(rhs(_x_in), 'list') then error "'eventfired' must be specified as a list" end if; if _nevt = 0 then error "this solution has no events" end if; if _dtbl[4] <> 2 and _dtbl[4] <> 3 then error "'direction' must be set prior to calling/setting 'eventfired'" end if; _i := _dtbl[4]; _val := NULL; if not assigned(_EnvEventRetriggerWarned) then _EnvEventRetriggerWarned := false end if; for _k in rhs(_x_in) do if type(_k, 'integer') then _src := _k elif type(_k, 'integer' = 'anything') and type(evalf(rhs(_k)), 'numeric') then _k := lhs(_k) = evalf[max(Digits, 18)](rhs(_k)); _src := lhs(_k) else error "'eventfired' entry is not valid: %1", _k end if; if _src < 1 or round(_dtbl[1][3][1][_nevt+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nevt+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nevt)}; if nops(_src) <> 1 then error "'eventfired' can only be set/queried for root-finding events and time/interval events" end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] <> 0. and _dtbl[1][3][1][_src, 2]-2. <> 0. then error "'eventfired' can only be set/queried for root-finding events and time/interval events" elif irem(round(_dtbl[1][3][1][_src, 4]), 2) = 1 then if _EnvEventRetriggerWarned = false then WARNING(`'eventfired' has no effect on events that retrigger`) end if; _EnvEventRetriggerWarned := true end if; if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then _val := _val, undefined elif type(_dtbl[_i][3][4][_src, _i-1], 'undefined') or _i = 2 and _dtbl[2][3][1][_src, 8] < _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] < _dtbl[3][3][1][_src, 8] then _val := _val, _dtbl[_i][3][1][_src, 8] else _val := _val, _dtbl[_i][3][4][_src, _i-1] end if; if type(_k, `=`) then if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then error "cannot set event code for a rate hysteresis event" end if; userinfo(3, {'events', 'eventreset'}, `manual set event code `, _src, ` to value `, rhs(_k)); _dtbl[_i][3][1][_src, 8] := rhs(_k); _dtbl[_i][3][4][_src, _i-1] := rhs(_k) end if end do; return [_val] elif type(_x_in, `=`) and lhs(_x_in) = "direction" then if not member(rhs(_x_in), {-1, 1, ':-left', ':-right'}) then error "'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)" end if; _src := `if`(_dtbl[4] = 2, -1, `if`(_dtbl[4] = 3, 1, undefined)); _i := `if`(member(rhs(_x_in), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nevt then for _j to _nevt+1 do if _j <= _nevt and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if; return _src elif _x_in = "eventcount" then if _dtbl[1][3][1] = 0 or _dtbl[4] <> 2 and _dtbl[4] <> 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nevt+1, 12]) end if elif type(_x_in, `=`) and lhs(_x_in) = "setdatacallback" then if not type(rhs(_x_in), 'nonegint') then error "data callback must be a nonnegative integer (address)" end if; _dtbl[1][28] := rhs(_x_in) elif type(_x_in, `=`) and lhs(_x_in) = "Array" then _i := rhs(_x_in); if not type(_i, 'list') or nops(_i) <> 2 or not type(_i[1], 'numeric') or not type(_i[2], 'posint') or _i[2] < 2 then error "Array output must be specified as [end time, min number of points]" end if; _src := array(1 .. 1, [`dsolve/numeric/SC/IVPdcopy`(_dtbl[1])]); if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_src[1][14]), _pars, _neq, _y0) then `dsolve/numeric/SC/reinitialize`(_src, _y0, _neq, procname, _pars, 1) end if end if; if _src[1][4][7] = 0 then error "parameters must be initialized before solution can be computed" end if; _val := `dsolve/numeric/SC/IVPvalues`(_src[1], _x0 .. _i[1], _i[2], _i[2], []); if _val[3] <> "" then `dsolve/numeric/warning`(cat(`requested integration incomplete, received error:`, convert(_val[3], 'symbol'))) end if; _t1 := Array(1 .. _val[2], 0 .. _neq-_nevar+nops(_pars)); _t1[() .. (), 0] := _val[1][1 .. _val[2], 0]; for _i to _neq-_nevar do _t1[() .. (), _i] := _val[1][1 .. _val[2], _vmap[_i]] end do; for _i to nops(_pars) do _t1[() .. (), _neq-_nevar+_i] := _val[1][1 .. _val[2], _neq+_i] end do; return _t1 else return "procname" end if end if; if _x_out = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _neq-_nevar)] end if; _i := `if`(_x0 <= _x_out, 3, 2); if _x_in = "last" and 0 < _dtbl[_i][4][9] and _dtbl[_i][4][9] < 100 then _dat := eval(_dtbl[_i], 2); _j := _dat[4][20]; return [_dat[11][_j, 0], seq(_dat[11][_j, _vmap[_i]], _i = 1 .. _neq-_nevar-_ndisc), seq(_dat[8][1][_vmap[_i]], _i = _neq-_nevar-_ndisc+1 .. _neq-_nevar)] end if; if not type(_dtbl[_i], 'array') then _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nevt then for _j to _nevt+1 do if _j <= _nevt and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if end if; if _x_in <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _neq, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _neq, procname, _pars, _i) end if end if; if _dtbl[1][4][7] = 0 then error "parameters must be initialized before solution can be computed" end if end if; _dat := eval(_dtbl[_i], 2); _dtbl[4] := _i; try _src := `dsolve/numeric/SC/IVPrun`(_dat, _x_out) catch: userinfo(2, `dsolve/debug`, print(`Exception in solnproc:`, [lastexception][2 .. -1])); error  end try; if _dat[17] <> _dtbl[1][17] then _dtbl[1][17] := _dat[17]; _dtbl[1][10] := _dat[10] end if; if _src = 0 and 100 < _dat[4][9] then _val := _dat[3][1][_nevt+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src <> 0 or _dat[4][9] <= 0 then _dtbl[1][5][1] := _x_out else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _x_out then Rounding := -infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further right of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further right of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further right of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nevt+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nevt+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further right of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _x_out := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _x_out < _val then Rounding := infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further left of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further left of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further left of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nevt+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nevt+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further left of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _x_out := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _digits := _dat[4][26]; if type(_EnvDSNumericSaveDigits, 'posint') then _dat[4][26] := _EnvDSNumericSaveDigits else _dat[4][26] := Digits end if; _Env_dsolve_SC_native := true; if _dat[4][25] = 1 then _i := 1; _dat[4][25] := 2 else _i := _dat[4][25] end if; _val := `dsolve/numeric/SC/IVPval`(_dat, _x_out, _src); _dat[4][25] := _i; _dat[4][26] := _digits; [_x_out, seq(_val[_vmap[_i]], _i = 1 .. _neq-_nevar)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _x_out, _src); [_x_out, seq(_val[_vmap[_i]], _i = 1 .. _neq-_nevar)] end if end proc, (2) = Array(0..0, {}), (3) = [t, r(t), varphi(t)], (4) = []}); _vars := _dat[3]; _pars := map(lhs, _dat[4]); _n := nops(_vars)-1; _solnproc := _dat[1]; if not type(_xout, 'numeric') then if member(x_rosenbrock, ["start", 'start', "method", 'method', "left", 'left', "right", 'right', "leftdata", "rightdata", "enginedata", "eventstop", 'eventstop', "eventclear", 'eventclear', "eventstatus", 'eventstatus', "eventcount", 'eventcount', "laxtol", 'laxtol', "numfun", 'numfun', NULL]) then _res := _solnproc(convert(x_rosenbrock, 'string')); if 1 < nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res <> "procname" then return _res end if elif member(x_rosenbrock, ["last", 'last', "initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(x_rosenbrock, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(x_rosenbrock), 'string') = rhs(x_rosenbrock); if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else error "initial and/or parameter values must be specified in a list" end if; if lhs(_xout) = "initial" then return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["eventdisable", 'eventdisable', "eventenable", 'eventenable', "eventfired", 'eventfired', "direction", 'direction', "Array", 'Array', NULL]) then return _solnproc(convert(lhs(x_rosenbrock), 'string') = rhs(x_rosenbrock)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _vars elif _xout = "Array" then return [op(_vars), op(_pars)] end if; if procname <> unknown then return ('procname')(x_rosenbrock) else _ndsol := 1; _ndsol := _ndsol; _ndsol := pointto(_dat[2][0]); return ('_ndsol')(x_rosenbrock) end if end if; try _res := _solnproc(_xout); [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] catch: error  end try end proc

soln := dsolve({eq1, eq2, ics}, {r(t), `&varphi;`(t)}, numeric, method = gear)

proc (x_gear) local _res, _dat, _vars, _solnproc, _xout, _ndsol, _pars, _n, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 < nargs then error "invalid input: too many arguments" end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x_gear) else _xout := evalf(x_gear) end if; _dat := Array(1..4, {(1) = proc (_xin) local _xout, _n, _y0, _yn, _yl, _ym, err, _ctl, _octl, _reinit, _errcd, _pars, _yini, _ini, _par, _fcn, _i; option `Copyright (c) 2002 by the University of Waterloo. All rights reserved.`; table( [( "complex" ) = false ] ) _xout := _xin; _ctl := array( 1 .. 19, [( 1 ) = (2), ( 2 ) = (0.), ( 3 ) = (0.), ( 4 ) = (0.5e-2), ( 5 ) = (0.1e-4), ( 6 ) = (-1), ( 7 ) = (0), ( 9 ) = (6), ( 8 ) = (4), ( 11 ) = (-1), ( 10 ) = (0), ( 13 ) = (-1), ( 12 ) = (-1), ( 15 ) = (-1), ( 14 ) = (0), ( 18 ) = (0), ( 19 ) = (0), ( 16 ) = (0), ( 17 ) = (0)  ] ); _octl := array( 1 .. 19, [( 1 ) = (2), ( 2 ) = (0.), ( 3 ) = (0.), ( 4 ) = (0.5e-2), ( 5 ) = (0.1e-4), ( 6 ) = (-1), ( 7 ) = (0), ( 9 ) = (6), ( 8 ) = (4), ( 11 ) = (-1), ( 10 ) = (0), ( 13 ) = (-1), ( 12 ) = (-1), ( 15 ) = (-1), ( 14 ) = (0), ( 18 ) = (0), ( 19 ) = (0), ( 16 ) = (0), ( 17 ) = (0)  ] ); _n := trunc(_ctl[1]); _yini := Array(0..2, {(1) = 0., (2) = 2.0}); _y0 := Array(0..2, {(1) = 0., (2) = 2.0}); _yl := Array(1..2, {(1) = 0, (2) = 0}); _ym := Array(1..2, {(1) = 0, (2) = 0}); _yn := Array(1..2, {(1) = 0, (2) = 0}); _fcn := proc (N, X, Y, YP) option `[Y[1] = r(t), Y[2] = varphi(t)]`; YP[1] := -1-cos(Y[2]); YP[2] := -1+sin(Y[2])/Y[1]; 0 end proc; _pars := []; if not type(_xout, 'numeric') then if member(_xout, ["start", "left", "right"]) then return _y0[0] elif _xout = "method" then return "gear" elif _xout = "numfun" then return round(_ctl[19]) elif _xout = "initial" then return [seq(_yini[_i], _i = 0 .. _n)] elif _xout = "parameters" then return [seq(_yini[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return [seq(_yini[_i], _i = 0 .. _n)], [seq(_yini[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "last" then if _ctl[3]-_y0[0] <> 0. then _xout := _ctl[3] elif _ctl[2]-_y0[0] <> 0. then _xout := _ctl[2] else error "no information is available on last computed point" end if elif _xout = "enginedata" then return eval(_octl, 1) elif _xout = "function" then return eval(_fcn, 1) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {"initial", "parameters", "initial_and_parameters"}) then _ini, _par := [], []; if lhs(_xin) = "initial" then _ini := rhs(_xin) elif lhs(_xin) = "parameters" then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) <> [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) < nops(_pars)+1 then error "insufficient data for specification of initial and parameters" else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par <> [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _yini) end if; if _ini <> [] then `dsolve/numeric/process_initial`(_n, _ini, _yini, _pars) end if; if _pars <> [] then _par := {seq(rhs(_pars[_i]) = _yini[_n+_i], _i = 1 .. nops(_pars))}; for _i from 0 to _n do _y0[_i] := subs(_par, _yini[_i]) end do; for _i from _n+1 to _n+nops(_pars) do _y0[_i] := _yini[_i] end do else for _i from 0 to _n do _y0[_i] := _yini[_i] end do end if; _octl[2] := _y0[0]; _octl[3] := _y0[0]; for _i to 17 do _ctl[_i] := _octl[_i] end do; for _i to _n do _yl[_i] := _y0[_i]; _ym[_i] := 1.0 end do; if _Env_smart_dsolve_numeric = true and type(_y0[0], 'numeric') then procname("right") := _y0[0]; procname("left") := _y0[0] end if; if _xout = "initial" then return [seq(_yini[_i], _i = 0 .. _n)] elif _xout = "parameters" then return [seq(_yini[_n+_i], _i = 1 .. nops(_pars))] else return [seq(_yini[_i], _i = 0 .. _n)], [seq(_yini[_n+_i], _i = 1 .. nops(_pars))] end if else return "procname" end if end if; if _xout-_y0[0] = 0. then return [seq(evalf(_y0[_i]), _i = 0 .. _n)] end if; _reinit := false; if _xin <> "last" then if 0 < 0 and `dsolve/numeric/checkglobals`(0, table( [ ] ), _pars, _n, _yini) then _reinit := true; if _pars <> [] then _par := {seq(rhs(_pars[_i]) = _yini[_n+_i], _i = 1 .. nops(_pars))}; for _i from 0 to _n do _y0[_i] := subs(_par, _yini[_i]) end do; for _i from _n+1 to _n+nops(_pars) do _y0[_i] := _yini[_i] end do else for _i from 0 to _n do _y0[_i] := _yini[_i] end do end if end if; if _pars <> [] and select(type, {seq(_yini[_n+_i], _i = 1 .. nops(_pars))}, 'undefined') <> {} then error "parameters must be initialized before solution can be computed" end if end if; if not _reinit and _xout-_ctl[3] = 0 then [_ctl[3], seq(_yn[_i], _i = 1 .. _n)] elif not _reinit and _xout-_ctl[2] = 0 then [_ctl[2], seq(_yl[_i], _i = 1 .. _n)] else if _ctl[2]-_y0[0] = 0. or sign(_ctl[2]-_y0[0]) <> sign(_xout-_ctl[2]) or abs(_xout-_y0[0]) < abs(_xout-_ctl[2]) or _reinit then for _i to 17 do _ctl[_i] := _octl[_i] end do; for _i to _n do _yl[_i] := _y0[_i]; _ym[_i] := 1.0 end do; for _i from _n+1 to _n+nops(_pars) do _yl[_i] := _y0[_i] end do end if; _ctl[3] := _xout; err := Array(1..2, {(1) = 0, (2) = 0}); if Digits <= evalhf(Digits) then try _errcd := evalhf(`dsolve/numeric/gear`(_fcn, var(_ctl), var(_yl), var(_ym), var(_yn), var(err), 0)) catch: userinfo(2, `dsolve/debug`, print(`Exception in gear:`, [lastexception])); if searchtext('evalhf', lastexception[2]) <> 0 or searchtext('real', lastexception[2]) <> 0 or searchtext('hardware', lastexception[2]) <> 0 then _errcd := `dsolve/numeric/gear`(_fcn, _ctl, _yl, _ym, _yn, err, 0) else error  end if end try else _errcd := `dsolve/numeric/gear`(_fcn, _ctl, _yl, _ym, _yn, err, 0) end if; if _errcd < 0 then userinfo(2, {dsolve, `dsolve/gear`}, `Last values returned:`); userinfo(2, {dsolve, `dsolve/gear`}, ` t =`, _ctl[2]); userinfo(2, {dsolve, `dsolve/gear`}, ` h =`, _ctl[4]); userinfo(2, {dsolve, `dsolve/gear`}, ` y =`, _yl[1]); for _i from 2 to _n do userinfo(2, {dsolve, `dsolve/gear`}, `	 `, _yl[_i]) end do; Rounding := `if`(_y0[0] < _xout, -infinity, infinity); if _errcd+1. = 0. then error "cannot evaluate the solution past %1, step taken with h = hmin but the requested error not achieved", evalf[8](_ctl[3]) elif _errcd+2. = 0. then error "cannot evaluate the solution past %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_ctl[3]) else error "cannot evaluate the solution past %1, unknown error code returned from gear %2", evalf[8](_ctl[3]), trunc(_errcd) end if end if; if _Env_smart_dsolve_numeric = true then if _y0[0] < _xout and procname("right") < _xout then procname("right") := _xout elif _xout < _y0[0] and _xout < procname("left") then procname("left") := _xout end if end if; [_xout, seq(_yn[_i], _i = 1 .. _n)] end if end proc, (2) = Array(0..0, {}), (3) = [t, r(t), varphi(t)], (4) = []}); _vars := _dat[3]; _pars := map(lhs, _dat[4]); _n := nops(_vars)-1; _solnproc := _dat[1]; if not type(_xout, 'numeric') then if member(x_gear, ["start", 'start', "method", 'method', "left", 'left', "right", 'right', "leftdata", "rightdata", "enginedata", "eventstop", 'eventstop', "eventclear", 'eventclear', "eventstatus", 'eventstatus', "eventcount", 'eventcount', "laxtol", 'laxtol', "numfun", 'numfun', NULL]) then _res := _solnproc(convert(x_gear, 'string')); if 1 < nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res <> "procname" then return _res end if elif member(x_gear, ["last", 'last', "initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(x_gear, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(x_gear), 'string') = rhs(x_gear); if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else error "initial and/or parameter values must be specified in a list" end if; if lhs(_xout) = "initial" then return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["eventdisable", 'eventdisable', "eventenable", 'eventenable', "eventfired", 'eventfired', "direction", 'direction', "Array", 'Array', NULL]) then return _solnproc(convert(lhs(x_gear), 'string') = rhs(x_gear)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _vars elif _xout = "Array" then return [op(_vars), op(_pars)] end if; if procname <> unknown then return ('procname')(x_gear) else _ndsol := 1; _ndsol := _ndsol; _ndsol := pointto(_dat[2][0]); return ('_ndsol')(x_gear) end if end if; try _res := _solnproc(_xout); [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] catch: error  end try end proc

The help pages have more

help("dsolve,numeric")

help("dsolve,numeric,ivp")

NULL

Download test.mw

Edit: I have added sampling of various initial points to show that the wolf always catches the goat.

This version assumes wolf speed = goat speed and each is constant. It also assumes the wolf's velocity vector is always directed at the goat.

restart

with(plots)

Take the origin to be the location of the stake fixing one end of the rope, which is of lengthNULL1, and take the goat's initial position as 1, 0. Without loss of generality, we take the common speed to be 1.
Let x, y be the wolf coordinates and X, Y be the goat coordinates.
We 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.e., the tangent to the wolf's trajectory points at the goat. The tangent vector is given by diff(x(t), t), diff(y(t), t)and therefore (X(t), Y(t)) = (x(t), y(t))+lambda(t)*(diff(x(t), t), diff(y(t), t)) for some function lambda(t). Therefore we have the two odes

de1 := X(t) = x(t)+(diff(x(t), t))*lambda(t); de2 := Y(t) = y(t)+(diff(y(t), t))*lambda(t)

X(t) = x(t)+(diff(x(t), t))*lambda(t)

Y(t) = y(t)+(diff(y(t), t))*lambda(t)

And the speeds are each 1.

de3 := (diff(X(t), t))^2+(diff(Y(t), t))^2 = 1; de4 := (diff(x(t), t))^2+(diff(y(t), t))^2 = 1

(diff(X(t), t))^2+(diff(Y(t), t))^2 = 1

(diff(x(t), t))^2+(diff(y(t), t))^2 = 1

And the goat moves on the unit circle.

eq5 := X(t)^2+Y(t)^2 = 1

X(t)^2+Y(t)^2 = 1

Let the initial position of the wolf be x__0, y__0. Then the vector from here to the goat is 1-x__0, -y__0, so(D(x))(0) = (1-x__0)/lambda(0), (D(y))(0) = -y__0/lambda(0).

But the squares of these sum to 1 so ((1-x__0)^2+y__0^2)/lambda(0)^2 = 1, or "lambda(0)=sqrt((1-`x__0`)^(2)+`y__0`^(2))." For y__0 > 0, the initial velocity of the goat is downwards (presumably, though we could assume otherwise).

inswolf := {lambda(0) = sqrt((1-x__0)^2+y__0^2), x(0) = x__0, y(0) = y__0}; insgoat := {X(0) = 1, Y(0) = 0, (D(X))(0) = 0, (D(Y))(0) = -1}; ins := `union`(inswolf, insgoat)

{lambda(0) = ((1-x__0)^2+y__0^2)^(1/2), x(0) = x__0, y(0) = y__0}

{X(0) = 1, Y(0) = 0, (D(X))(0) = 0, (D(Y))(0) = -1}

Sample start point for the wolf for numerical solution.

ins1 := eval(ins, {x__0 = 5, y__0 = 1/2})

{X(0) = 1, Y(0) = 0, lambda(0) = (1/4)*65^(1/2)*4^(1/2), x(0) = 5, y(0) = 1/2, (D(X))(0) = 0, (D(Y))(0) = -1}

Numerical solution

ansnum := dsolve(`union`({de1, de2, de3, de4, eq5}, ins1), [x(t), y(t), lambda(t), X(t), Y(t)], numeric, maxfun = 0)

proc (x_rkf45_dae) local _res, _dat, _vars, _solnproc, _xout, _ndsol, _pars, _n, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 < nargs then error "invalid input: too many arguments" end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x_rkf45_dae) else _xout := evalf(x_rkf45_dae) end if; _dat := Array(1..4, {(1) = proc (_x_in) local _x_out, _dtbl, _dat, _vmap, _x0, _y0, _val, _digits, _neq, _nevar, _ndisc, _nevt, _pars, _ini, _par, _i, _j, _k, _src, _t1; option `Copyright (c) 2002 by Waterloo Maple Inc. All rights reserved.`; table( [( "complex" ) = false ] ) _x_out := _x_in; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 28, [( 1 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 2 ) = (datatype = float[8], order = C_order, storage = rectangular), ( 3 ) = ([0, 0, 0, Array(1..0, 1..2, {}, datatype = float[8], order = C_order)]), ( 4 ) = (Array(1..65, {(1) = 7, (2) = 7, (3) = 0, (4) = 0, (5) = 0, (6) = 4, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 0, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0, (50) = 50, (51) = 1, (52) = 0, (53) = 0, (54) = 0, (55) = 0, (56) = 0, (57) = 0, (58) = 0, (59) = 10000, (60) = 0, (61) = 1000, (62) = 0, (63) = 0, (64) = -1, (65) = 0}, datatype = integer[8])), ( 5 ) = (Array(1..28, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = 0.2523829377920773e-2, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .49999999999999, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = 0.10e-14, (26) = .0, (27) = .0, (28) = .0}, datatype = float[8], order = C_order)), ( 6 ) = (Array(1..7, {(1) = 5.0, (2) = .5, (3) = 4.03112887414927, (4) = 1.0, (5) = .0, (6) = .0, (7) = -1.0}, datatype = float[8], order = C_order)), ( 7 ) = ([Array(1..4, 1..7, {(1, 1) = .0, (1, 2) = .203125, (1, 3) = .3046875, (1, 4) = .75, (1, 5) = .8125, (1, 6) = .40625, (1, 7) = .8125, (2, 1) = 0.6378173828125e-1, (2, 2) = .0, (2, 3) = .279296875, (2, 4) = .27237892150878906, (2, 5) = -0.9686851501464844e-1, (2, 6) = 0.1956939697265625e-1, (2, 7) = .5381584167480469, (3, 1) = 0.31890869140625e-1, (3, 2) = .0, (3, 3) = -.34375, (3, 4) = -.335235595703125, (3, 5) = .2296142578125, (3, 6) = .41748046875, (3, 7) = 11.480712890625, (4, 1) = 0.9710520505905151e-1, (4, 2) = .0, (4, 3) = .40350341796875, (4, 4) = 0.20297467708587646e-1, (4, 5) = -0.6054282188415527e-2, (4, 6) = -0.4770040512084961e-1, (4, 7) = .77858567237854}, datatype = float[8], order = C_order), Array(1..6, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = 1.0, (2, 1) = .25, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = 1.0, (3, 1) = .1875, (3, 2) = .5625, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = 2.0, (4, 1) = .23583984375, (4, 2) = -.87890625, (4, 3) = .890625, (4, 4) = .0, (4, 5) = .0, (4, 6) = .2681884765625, (5, 1) = .1272735595703125, (5, 2) = -.5009765625, (5, 3) = .44921875, (5, 4) = -0.128936767578125e-1, (5, 5) = .0, (5, 6) = 0.626220703125e-1, (6, 1) = -0.927734375e-1, (6, 2) = .626220703125, (6, 3) = -.4326171875, (6, 4) = .1418304443359375, (6, 5) = -0.861053466796875e-1, (6, 6) = .3131103515625}, datatype = float[8], order = C_order), Array(1..6, {(1) = .0, (2) = .386, (3) = .21, (4) = .63, (5) = 1.0, (6) = 1.0}, datatype = float[8], order = C_order), Array(1..6, {(1) = .25, (2) = -.1043, (3) = .1035, (4) = -0.362e-1, (5) = .0, (6) = .0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 1.544, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = .9466785280815533, (3, 2) = .25570116989825814, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = 3.3148251870684886, (4, 2) = 2.896124015972123, (4, 3) = .9986419139977808, (4, 4) = .0, (4, 5) = .0, (5, 1) = 1.2212245092262748, (5, 2) = 6.019134481287752, (5, 3) = 12.537083329320874, (5, 4) = -.687886036105895, (5, 5) = .0, (6, 1) = 1.2212245092262748, (6, 2) = 6.019134481287752, (6, 3) = 12.537083329320874, (6, 4) = -.687886036105895, (6, 5) = 1.0}, datatype = float[8], order = C_order), Array(1..6, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = -5.6688, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (3, 1) = -2.4300933568337584, (3, 2) = -.20635991570891224, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (4, 1) = -.10735290581452621, (4, 2) = -9.594562251021896, (4, 3) = -20.470286148096154, (4, 4) = .0, (4, 5) = .0, (5, 1) = 7.496443313968615, (5, 2) = -10.246804314641219, (5, 3) = -33.99990352819906, (5, 4) = 11.708908932061595, (5, 5) = .0, (6, 1) = 8.083246795922411, (6, 2) = -7.981132988062785, (6, 3) = -31.52159432874373, (6, 4) = 16.319305431231363, (6, 5) = -6.0588182388340535}, datatype = float[8], order = C_order), Array(1..3, 1..5, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (2, 1) = 10.126235083446911, (2, 2) = -7.487995877607633, (2, 3) = -34.800918615557414, (2, 4) = -7.9927717075687275, (2, 5) = 1.0251377232956207, (3, 1) = -.6762803392806898, (3, 2) = 6.087714651678606, (3, 3) = 16.43084320892463, (3, 4) = 24.767225114183653, (3, 5) = -6.5943891257167815}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..7, {(1) = .1, (2) = .1, (3) = .1, (4) = .1, (5) = .1, (6) = .1, (7) = .1}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, 1..7, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (4, 7) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (7, 7) = .0}, datatype = float[8], order = C_order), Array(1..7, 1..7, {(1, 1) = .4923076923076935, (1, 2) = 0.6153846153846169e-1, (1, 3) = -.49613893835683565, (1, 4) = -.4923076923076935, (1, 5) = .0, (1, 6) = -0.6153846153846169e-1, (1, 7) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = -2.0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = 2.0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = 1.0, (4, 6) = -1.0, (4, 7) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (7, 7) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, 1..7, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (4, 7) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0, (7, 7) = .0}, datatype = float[8], order = C_order), Array(1..7, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (7, 1) = .0, (7, 2) = .0, (7, 3) = .0, (7, 4) = .0, (7, 5) = .0, (7, 6) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 0}, datatype = integer[8]), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..14, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = .0, (14) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 0}, datatype = integer[8])]), ( 8 ) = ([Array(1..7, {(1) = 5.0, (2) = .5, (3) = 4.03112887414927, (4) = 1.0, (5) = .0, (6) = .0, (7) = -1.0}, datatype = float[8], order = C_order), Array(1..7, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..7, {(1) = -.9922778767136688, (2) = -.1240347345892086, (3) = -.8759652654107917, (4) = .0, (5) = -1.0, (6) = -1.0, (7) = -.0}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..7, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (1, 7) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0, (2, 7) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (3, 4) = .0, (3, 5) = .0, (3, 6) = .0, (3, 7) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (4, 4) = .0, (4, 5) = .0, (4, 6) = .0, (4, 7) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (5, 4) = .0, (5, 5) = .0, (5, 6) = .0, (5, 7) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0, (6, 4) = .0, (6, 5) = .0, (6, 6) = .0, (6, 7) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) local Z1, Z2, Z3, Z4, Z5, Z6, Z7; Z1 := Y[1]-Y[4]; Z2 := 1/Y[3]; YP[1] := -Z2*Z1; Z3 := Y[2]-Y[6]; YP[2] := -Z3*Z2; Z2 := Y[4]^2; Z4 := Y[6]^2; Z5 := (-Y[2]+2*Y[6])*Y[2]; Z6 := (-Y[1]+2*Y[4])*Y[1]; Z7 := Z2+Z4-Z5-Z6; Z7 := 1/Z7; YP[3] := -(Z2+Z4-Z5-Z6-Y[3]*(-Z1*Y[5]-Z3*Y[7]))*Z7; Z1 := Y[5]^2+Y[7]^2; Z2 := Y[4]*Y[7]; Z3 := Y[6]*Y[5]; Z4 := Z2-Z3; Z4 := 1/Z4; YP[5] := -Y[7]*Z1*Z4; Z2 := Z2-Z3; Z2 := 1/Z2; YP[7] := Z1*Y[5]*Z2; YP[4] := Y[5]; YP[6] := Y[7]; 0 end proc, -1, proc (X, Y, R) local Z1, Z2; Z1 := Y[1]-Y[4]; Z2 := Y[2]-Y[6]; R[1] := -1+(Z1^2+Z2^2)/Y[3]^2; R[2] := Y[5]^2+Y[7]^2-1; R[3] := Y[4]^2+Y[6]^2-1; R[4] := Y[4]*Y[5]+Y[6]*Y[7]; 0 end proc, proc (X, Y, J) local Z1, Z2, Z3, Z4; J[1 .. 4, 1 .. 7] := 0; Z1 := Y[1]-Y[4]; Z2 := 1/Y[3]; Z3 := Z2^2; J[1, 1] := 2*Z3*Z1; Z4 := Y[2]-Y[6]; J[1, 2] := 2*Z4*Z3; Z2 := Z2^3; J[1, 3] := -2*(Z1^2+Z4^2)*Z2; J[1, 4] := -2*Z3*Z1; J[1, 6] := -2*Z4*Z3; J[2, 5] := 2*Y[5]; J[2, 7] := 2*Y[7]; J[3, 4] := 2*Y[4]; J[3, 6] := 2*Y[6]; J[4, 4] := Y[5]; J[4, 5] := Y[4]; J[4, 6] := Y[7]; J[4, 7] := Y[6]; 0 end proc, 0, 0, 0, 0, 0, 0, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rkf45"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([proc (X, Y, R) local Z1, Z2; Z1 := Y[1]-Y[4]; Z2 := Y[2]-Y[6]; R[1] := -1+(Z1^2+Z2^2)/Y[3]^2; R[2] := Y[5]^2+Y[7]^2-1; R[3] := Y[4]^2+Y[6]^2-1; R[4] := Y[4]*Y[5]+Y[6]*Y[7]; 0 end proc, proc (X, Y, J) local Z1, Z2, Z3, Z4; J[1 .. 4, 1 .. 7] := 0; Z1 := Y[1]-Y[4]; Z2 := 1/Y[3]; Z3 := Z2^2; J[1, 1] := 2*Z3*Z1; Z4 := Y[2]-Y[6]; J[1, 2] := 2*Z4*Z3; Z2 := Z2^3; J[1, 3] := -2*(Z1^2+Z4^2)*Z2; J[1, 4] := -2*Z3*Z1; J[1, 6] := -2*Z4*Z3; J[2, 5] := 2*Y[5]; J[2, 7] := 2*Y[7]; J[3, 4] := 2*Y[4]; J[3, 6] := 2*Y[6]; J[4, 4] := Y[5]; J[4, 5] := Y[4]; J[4, 6] := Y[7]; J[4, 7] := Y[6]; 0 end proc, 0, 0, Array(1..7, {(1) = 0.24424906541753444e-14, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0}, datatype = float[8], order = C_order), Array(1..4, {(1) = .0, (2) = .0, (3) = .0, (4) = .0}, datatype = float[8], order = C_order), [-1+((x(t)-X(t))^2+(y(t)-Y(t))^2)/lambda(t)^2, (diff(X(t), t))^2+(diff(Y(t), t))^2-1, X(t)^2+Y(t)^2-1, (diff(X(t), t))*X(t)+(diff(Y(t), t))*Y(t)]]), ( 17 ) = ([proc (N, X, Y, YP) local Z1, Z2, Z3, Z4, Z5, Z6, Z7; Z1 := Y[1]-Y[4]; Z2 := 1/Y[3]; YP[1] := -Z2*Z1; Z3 := Y[2]-Y[6]; YP[2] := -Z3*Z2; Z2 := Y[4]^2; Z4 := Y[6]^2; Z5 := (-Y[2]+2*Y[6])*Y[2]; Z6 := (-Y[1]+2*Y[4])*Y[1]; Z7 := Z2+Z4-Z5-Z6; Z7 := 1/Z7; YP[3] := -(Z2+Z4-Z5-Z6-Y[3]*(-Z1*Y[5]-Z3*Y[7]))*Z7; Z1 := Y[5]^2+Y[7]^2; Z2 := Y[4]*Y[7]; Z3 := Y[6]*Y[5]; Z4 := Z2-Z3; Z4 := 1/Z4; YP[5] := -Y[7]*Z1*Z4; Z2 := Z2-Z3; Z2 := 1/Z2; YP[7] := Z1*Y[5]*Z2; YP[4] := Y[5]; YP[6] := Y[7]; 0 end proc, -1, proc (X, Y, R) local Z1, Z2; Z1 := Y[1]-Y[4]; Z2 := Y[2]-Y[6]; R[1] := -1+(Z1^2+Z2^2)/Y[3]^2; R[2] := Y[5]^2+Y[7]^2-1; R[3] := Y[4]^2+Y[6]^2-1; R[4] := Y[4]*Y[5]+Y[6]*Y[7]; 0 end proc, proc (X, Y, J) local Z1, Z2, Z3, Z4; J[1 .. 4, 1 .. 7] := 0; Z1 := Y[1]-Y[4]; Z2 := 1/Y[3]; Z3 := Z2^2; J[1, 1] := 2*Z3*Z1; Z4 := Y[2]-Y[6]; J[1, 2] := 2*Z4*Z3; Z2 := Z2^3; J[1, 3] := -2*(Z1^2+Z4^2)*Z2; J[1, 4] := -2*Z3*Z1; J[1, 6] := -2*Z4*Z3; J[2, 5] := 2*Y[5]; J[2, 7] := 2*Y[7]; J[3, 4] := 2*Y[4]; J[3, 6] := 2*Y[6]; J[4, 4] := Y[5]; J[4, 5] := Y[4]; J[4, 6] := Y[7]; J[4, 7] := Y[6]; 0 end proc, 0, 0, 0, 0, 0, 0, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 27 ) = (""), ( 26 ) = (Array(1..0, {})), ( 25 ) = (Array(1..0, {})), ( 24 ) = (0), ( 28 ) = (0)  ] ))  ] ); _y0 := Array(0..7, {(1) = 0., (2) = 5., (3) = .5000000000000000000000, (4) = 4.031128874149274826182, (5) = 1., (6) = 0., (7) = 0.}); _vmap := array( 1 .. 7, [( 1 ) = (1), ( 2 ) = (2), ( 3 ) = (3), ( 4 ) = (4), ( 5 ) = (5), ( 6 ) = (6), ( 7 ) = (7)  ] ); _x0 := _dtbl[1][5][5]; _neq := _dtbl[1][4][1]; _nevar := _dtbl[1][4][3]; _ndisc := _dtbl[1][4][4]; _nevt := _dtbl[1][4][16]; if not type(_x_out, 'numeric') then if member(_x_out, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _x_out = "left" then if type(_dtbl[2], 'array') then return _dtbl[2][5][1] end if elif _x_out = "right" then if type(_dtbl[3], 'array') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _x_out = "method" then return _dtbl[1][15] elif _x_out = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _x_out = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _x_out = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _x_out = "enginedata" then return _dtbl[1] elif _x_out = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _x_out = "initial" then return procname(_y0[0]) elif _x_out = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _x_out = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _x_out = "parameters" then return [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] elif _x_out = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] elif _x_out = "last" then if _dtbl[4] <> 2 and _dtbl[4] <> 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error "no information is available on last computed point" else _x_out := _dtbl[_dtbl[4]][5][1] end if elif _x_out = "function" then if _dtbl[1][4][33]-2. = 0 then return eval(_dtbl[1][10], 1) else return eval(_dtbl[1][10][1], 1) end if elif _x_out = "map" then return copy(_vmap) elif type(_x_in, `=`) and type(rhs(_x_in), 'list') and member(lhs(_x_in), {"initial", "parameters", "initial_and_parameters"}) then _ini, _par := [], []; if lhs(_x_in) = "initial" then _ini := rhs(_x_in) elif lhs(_x_in) = "parameters" then _par := rhs(_x_in) elif select(type, rhs(_x_in), `=`) <> [] then _par, _ini := selectremove(type, rhs(_x_in), `=`) elif nops(rhs(_x_in)) < nops(_pars)+1 then error "insufficient data for specification of initial and parameters" else _par := rhs(_x_in)[-nops(_pars) .. -1]; _ini := rhs(_x_in)[1 .. -nops(_pars)-1] end if; _x_out := lhs(_x_out); _i := false; if _par <> [] then _i := `dsolve/numeric/process_parameters`(_neq, _pars, _par, _y0) end if; if _ini <> [] then _i := `dsolve/numeric/process_initial`(_neq-_nevar, _ini, _y0, _pars, _vmap) or _i end if; if _i then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _neq, procname, _pars); if _Env_smart_dsolve_numeric = true and type(_y0[0], 'numeric') and _dtbl[1][4][10] <> 1 then procname("right") := _y0[0]; procname("left") := _y0[0] end if end if; if _x_out = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _neq-_nevar)] elif _x_out = "parameters" then return [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _neq-_nevar)], [seq(_y0[_neq+_i], _i = 1 .. nops(_pars))] end if elif _x_in = "eventstop" then if _nevt = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 <= _dtbl[5-_i][4][9] then _i := 5-_i; _dtbl[4] := _i; _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) elif 100 <= _dtbl[_i][4][9] then _j := round(_dtbl[_i][4][17]); return round(_dtbl[_i][3][1][_j, 1]) else return 0 end if elif _x_in = "eventstatus" then if _nevt = 0 then error "this solution has no events" end if; _i := [selectremove(proc (a) options operator, arrow; _dtbl[1][3][1][a, 7] = 1 end proc, {seq(_j, _j = 1 .. round(_dtbl[1][3][1][_nevt+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _x_in = "eventclear" then if _nevt = 0 then error "this solution has no events" end if; _i := _dtbl[4]; if _i <> 2 and _i <> 3 then error "no events to clear" end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] < 100 and 100 < _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] < 100 then error "no events to clear" elif _nevt < _dtbl[_i][4][9]-100 then error "event error condition cannot be cleared" else _j := _dtbl[_i][4][9]-100; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error "retriggerable events cannot be cleared" end if; _j := round(_dtbl[_i][3][1][_j, 1]); for _k to _nevt do if _dtbl[_i][3][1][_k, 1] = _j then if _dtbl[_i][3][1][_k, 2] = 3 then error "range events cannot be cleared" end if; _dtbl[_i][3][1][_k, 8] := _dtbl[_i][3][1][_nevt+1, 8] end if end do; _dtbl[_i][4][17] := 0; _dtbl[_i][4][9] := 0; if _dtbl[1][4][10] = 1 then if _i = 2 then try procname(procname("left")) catch:  end try else try procname(procname("right")) catch:  end try end if end if end if; return  elif type(_x_in, `=`) and member(lhs(_x_in), {"eventdisable", "eventenable"}) then if _nevt = 0 then error "this solution has no events" end if; if type(rhs(_x_in), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_x_in))} elif type(rhs(_x_in), 'posint') then _i := {rhs(_x_in)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nevt+1, 1]) end if; if select(proc (a) options operator, arrow; _nevt < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nevt+1, 1]) end if; _k := {}; for _j to _nevt do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_x_in) = "eventdisable" then _dtbl[4] := 0; _j := [evalb(assigned(_dtbl[2]) and member(_dtbl[2][4][17], _i)), evalb(assigned(_dtbl[3]) and member(_dtbl[3][4][17], _i))]; for _k in _i do _dtbl[1][3][1][_k, 7] := 0; if assigned(_dtbl[2]) then _dtbl[2][3][1][_k, 7] := 0 end if; if assigned(_dtbl[3]) then _dtbl[3][3][1][_k, 7] := 0 end if end do; if _j[1] then for _k to _nevt+1 do if _k <= _nevt and not type(_dtbl[2][3][4][_k, 1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to defined init `, _dtbl[2][3][4][_k, 1]); _dtbl[2][3][1][_k, 8] := _dtbl[2][3][4][_k, 1] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to rate hysteresis init `, _dtbl[2][5][24]); _dtbl[2][3][1][_k, 8] := _dtbl[2][5][24] elif _dtbl[2][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[2][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to initial init `, _x0); _dtbl[2][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #2, event code `, _k, ` to fireinitial init `, _x0-1); _dtbl[2][3][1][_k, 8] := _x0-1 end if end do; _dtbl[2][4][17] := 0; _dtbl[2][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("left")) end if end if; if _j[2] then for _k to _nevt+1 do if _k <= _nevt and not type(_dtbl[3][3][4][_k, 2], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to defined init `, _dtbl[3][3][4][_k, 2]); _dtbl[3][3][1][_k, 8] := _dtbl[3][3][4][_k, 2] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to rate hysteresis init `, _dtbl[3][5][24]); _dtbl[3][3][1][_k, 8] := _dtbl[3][5][24] elif _dtbl[3][3][1][_k, 2] = 0 and irem(iquo(round(_dtbl[3][3][1][_k, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to initial init `, _x0); _dtbl[3][3][1][_k, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #3, event code `, _k, ` to fireinitial init `, _x0+1); _dtbl[3][3][1][_k, 8] := _x0+1 end if end do; _dtbl[3][4][17] := 0; _dtbl[3][4][9] := 0; if _dtbl[1][4][10] = 1 then procname(procname("right")) end if end if else for _k in _i do _dtbl[1][3][1][_k, 7] := 1 end do; _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); _dtbl[4] := 0; if _dtbl[1][4][10] = 1 then if _x0 <= procname("right") then try procname(procname("right")) catch:  end try end if; if procname("left") <= _x0 then try procname(procname("left")) catch:  end try end if end if end if; return  elif type(_x_in, `=`) and lhs(_x_in) = "eventfired" then if not type(rhs(_x_in), 'list') then error "'eventfired' must be specified as a list" end if; if _nevt = 0 then error "this solution has no events" end if; if _dtbl[4] <> 2 and _dtbl[4] <> 3 then error "'direction' must be set prior to calling/setting 'eventfired'" end if; _i := _dtbl[4]; _val := NULL; if not assigned(_EnvEventRetriggerWarned) then _EnvEventRetriggerWarned := false end if; for _k in rhs(_x_in) do if type(_k, 'integer') then _src := _k elif type(_k, 'integer' = 'anything') and type(evalf(rhs(_k)), 'numeric') then _k := lhs(_k) = evalf[max(Digits, 18)](rhs(_k)); _src := lhs(_k) else error "'eventfired' entry is not valid: %1", _k end if; if _src < 1 or round(_dtbl[1][3][1][_nevt+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nevt+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nevt)}; if nops(_src) <> 1 then error "'eventfired' can only be set/queried for root-finding events and time/interval events" end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] <> 0. and _dtbl[1][3][1][_src, 2]-2. <> 0. then error "'eventfired' can only be set/queried for root-finding events and time/interval events" elif irem(round(_dtbl[1][3][1][_src, 4]), 2) = 1 then if _EnvEventRetriggerWarned = false then WARNING(`'eventfired' has no effect on events that retrigger`) end if; _EnvEventRetriggerWarned := true end if; if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then _val := _val, undefined elif type(_dtbl[_i][3][4][_src, _i-1], 'undefined') or _i = 2 and _dtbl[2][3][1][_src, 8] < _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] < _dtbl[3][3][1][_src, 8] then _val := _val, _dtbl[_i][3][1][_src, 8] else _val := _val, _dtbl[_i][3][4][_src, _i-1] end if; if type(_k, `=`) then if _dtbl[_i][3][1][_src, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_src, 4]), 32), 2) = 1 then error "cannot set event code for a rate hysteresis event" end if; userinfo(3, {'events', 'eventreset'}, `manual set event code `, _src, ` to value `, rhs(_k)); _dtbl[_i][3][1][_src, 8] := rhs(_k); _dtbl[_i][3][4][_src, _i-1] := rhs(_k) end if end do; return [_val] elif type(_x_in, `=`) and lhs(_x_in) = "direction" then if not member(rhs(_x_in), {-1, 1, ':-left', ':-right'}) then error "'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)" end if; _src := `if`(_dtbl[4] = 2, -1, `if`(_dtbl[4] = 3, 1, undefined)); _i := `if`(member(rhs(_x_in), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nevt then for _j to _nevt+1 do if _j <= _nevt and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #4, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if; return _src elif _x_in = "eventcount" then if _dtbl[1][3][1] = 0 or _dtbl[4] <> 2 and _dtbl[4] <> 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nevt+1, 12]) end if elif type(_x_in, `=`) and lhs(_x_in) = "setdatacallback" then if not type(rhs(_x_in), 'nonegint') then error "data callback must be a nonnegative integer (address)" end if; _dtbl[1][28] := rhs(_x_in) elif type(_x_in, `=`) and lhs(_x_in) = "Array" then _i := rhs(_x_in); if not type(_i, 'list') or nops(_i) <> 2 or not type(_i[1], 'numeric') or not type(_i[2], 'posint') or _i[2] < 2 then error "Array output must be specified as [end time, min number of points]" end if; _src := array(1 .. 1, [`dsolve/numeric/SC/IVPdcopy`(_dtbl[1])]); if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_src[1][14]), _pars, _neq, _y0) then `dsolve/numeric/SC/reinitialize`(_src, _y0, _neq, procname, _pars, 1) end if end if; if _src[1][4][7] = 0 then error "parameters must be initialized before solution can be computed" end if; _val := `dsolve/numeric/SC/IVPvalues`(_src[1], _x0 .. _i[1], _i[2], _i[2], []); if _val[3] <> "" then `dsolve/numeric/warning`(cat(`requested integration incomplete, received error:`, convert(_val[3], 'symbol'))) end if; _t1 := Array(1 .. _val[2], 0 .. _neq-_nevar+nops(_pars)); _t1[() .. (), 0] := _val[1][1 .. _val[2], 0]; for _i to _neq-_nevar do _t1[() .. (), _i] := _val[1][1 .. _val[2], _vmap[_i]] end do; for _i to nops(_pars) do _t1[() .. (), _neq-_nevar+_i] := _val[1][1 .. _val[2], _neq+_i] end do; return _t1 else return "procname" end if end if; if _x_out = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _neq-_nevar)] end if; _i := `if`(_x0 <= _x_out, 3, 2); if _x_in = "last" and 0 < _dtbl[_i][4][9] and _dtbl[_i][4][9] < 100 then _dat := eval(_dtbl[_i], 2); _j := _dat[4][20]; return [_dat[11][_j, 0], seq(_dat[11][_j, _vmap[_i]], _i = 1 .. _neq-_nevar-_ndisc), seq(_dat[8][1][_vmap[_i]], _i = _neq-_nevar-_ndisc+1 .. _neq-_nevar)] end if; if not type(_dtbl[_i], 'array') then _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nevt then for _j to _nevt+1 do if _j <= _nevt and not type(_dtbl[_i][3][4][_j, _i-1], 'undefined') then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to defined init `, _dtbl[_i][3][4][_j, _i-1]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][3][4][_j, _i-1] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 32), 2) = 1 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to rate hysteresis init `, _dtbl[_i][5][24]); _dtbl[_i][3][1][_j, 8] := _dtbl[_i][5][24] elif _dtbl[_i][3][1][_j, 2] = 0 and irem(iquo(round(_dtbl[_i][3][1][_j, 4]), 2), 2) = 0 then userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to initial init `, _x0); _dtbl[_i][3][1][_j, 8] := _x0 else userinfo(3, {'events', 'eventreset'}, `reinit #5, event code `, _j, ` to fireinitial init `, _x0-2*_i+5.0); _dtbl[_i][3][1][_j, 8] := _x0-2*_i+5.0 end if end do end if end if; if _x_in <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _neq, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _neq, procname, _pars, _i) end if end if; if _dtbl[1][4][7] = 0 then error "parameters must be initialized before solution can be computed" end if end if; _dat := eval(_dtbl[_i], 2); _dtbl[4] := _i; try _src := `dsolve/numeric/SC/IVPrun`(_dat, _x_out) catch: userinfo(2, `dsolve/debug`, print(`Exception in solnproc:`, [lastexception][2 .. -1])); error  end try; if _dat[17] <> _dtbl[1][17] then _dtbl[1][17] := _dat[17]; _dtbl[1][10] := _dat[10] end if; if _src = 0 and 100 < _dat[4][9] then _val := _dat[3][1][_nevt+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src <> 0 or _dat[4][9] <= 0 then _dtbl[1][5][1] := _x_out else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _x_out then Rounding := -infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further right of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further right of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further right of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nevt+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nevt+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further right of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _x_out := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _x_out < _val then Rounding := infinity; if _dat[4][9] = 1 then error "cannot evaluate the solution further left of %1, probably a singularity", evalf[8](_val) elif _dat[4][9] = 2 then error "cannot evaluate the solution further left of %1, maxfun limit exceeded (see ?dsolve,maxfun for details)", evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error "cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up" else error "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up" end if elif _dat[4][9] = 4 then error "cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'", evalf[8](_val) elif _dat[4][9] = 5 then error "cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem", evalf[8](_val) elif _dat[4][9] = 6 then error "cannot evaluate the solution further left of %1, cannot downgrade delay storage for problems with delay derivative order > 1, try increasing delaypts", evalf[8](_val) elif _dat[4][9] = 10 then error "cannot evaluate the solution further right of %1, interrupt requested", evalf[8](_val) elif 100 < _dat[4][9] then if _dat[4][9]-100 = _nevt+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nevt+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nevt+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop <> true then `dsolve/numeric/warning`(StringTools:-FormatMessage("cannot evaluate the solution further left of %1, event #%2 triggered a halt", evalf[8](_val), round(_dat[3][1][_dat[4][9]-100, 1]))) end if; Rounding := 'nearest'; _x_out := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _digits := _dat[4][26]; if type(_EnvDSNumericSaveDigits, 'posint') then _dat[4][26] := _EnvDSNumericSaveDigits else _dat[4][26] := Digits end if; _Env_dsolve_SC_native := true; if _dat[4][25] = 1 then _i := 1; _dat[4][25] := 2 else _i := _dat[4][25] end if; _val := `dsolve/numeric/SC/IVPval`(_dat, _x_out, _src); _dat[4][25] := _i; _dat[4][26] := _digits; [_x_out, seq(_val[_vmap[_i]], _i = 1 .. _neq-_nevar)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _x_out, _src); [_x_out, seq(_val[_vmap[_i]], _i = 1 .. _neq-_nevar)] end if end proc, (2) = Array(0..0, {}), (3) = [t, x(t), y(t), lambda(t), X(t), diff(X(t), t), Y(t), diff(Y(t), t)], (4) = []}); _vars := _dat[3]; _pars := map(lhs, _dat[4]); _n := nops(_vars)-1; _solnproc := _dat[1]; if not type(_xout, 'numeric') then if member(x_rkf45_dae, ["start", 'start', "method", 'method', "left", 'left', "right", 'right', "leftdata", "rightdata", "enginedata", "eventstop", 'eventstop', "eventclear", 'eventclear', "eventstatus", 'eventstatus', "eventcount", 'eventcount', "laxtol", 'laxtol', "numfun", 'numfun', NULL]) then _res := _solnproc(convert(x_rkf45_dae, 'string')); if 1 < nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res <> "procname" then return _res end if elif member(x_rkf45_dae, ["last", 'last', "initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(x_rkf45_dae, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(x_rkf45_dae), 'string') = rhs(x_rkf45_dae); if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else error "initial and/or parameter values must be specified in a list" end if; if lhs(_xout) = "initial" then return [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [seq(_vars[_i+1] = [_res][1][_i+1], _i = 0 .. _n), seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["eventdisable", 'eventdisable', "eventenable", 'eventenable', "eventfired", 'eventfired', "direction", 'direction', "Array", 'Array', NULL]) then return _solnproc(convert(lhs(x_rkf45_dae), 'string') = rhs(x_rkf45_dae)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _vars elif _xout = "Array" then return [op(_vars), op(_pars)] end if; if procname <> unknown then return ('procname')(x_rkf45_dae) else _ndsol := 1; _ndsol := _ndsol; _ndsol := pointto(_dat[2][0]); return ('_ndsol')(x_rkf45_dae) end if end if; try _res := _solnproc(_xout); [seq(_vars[_i+1] = _res[_i+1], _i = 0 .. _n)] catch: error  end try end proc

Red = wolf, blue = goat.

odeplot(ansnum, [[x(t), y(t)], [X(t), Y(t)]], 0 .. 20, color = [red, blue], scaling = constrained)

Separation vs time - looks like the wolf catches the goat in an asymptotic sense.

p1 := odeplot(ansnum, [[t, sqrt((x(t)-X(t))^2+(y(t)-Y(t))^2)]], 0 .. 50, color = red, view = [default, 0 .. 5])

Note that the motion of the goat is predetermined by its speed and initial condition since it must maintain constant speed, i.e., it can't turn around.

XYsol := {X(t) = cos(-t), Y(t) = sin(-t)}; odetest(XYsol, [de3, eq5, insgoat[]])

{X(t) = cos(t), Y(t) = -sin(t)}

[0, 0, 0, 0, 0, 0]

In terms of an analytical solution, Maple can reduce the system to a single ode in x(t) but not solve it. There is no result if the initial conditions are included.

dsolve(eval({de1, de2, de4}, XYsol), {lambda(t), x(t), y(t)})

[{x(t) = cos(t)}, {y(t) = -sin(t)}, {lambda(t) = 0}], [{(diff(diff(x(t), t), t))^2 = (-(2*(diff(x(t), t))^3*x(t)*sin(t)-2*(diff(x(t), t))^3*sin(t)*cos(t)-2*(diff(x(t), t))*x(t)*sin(t)+2*(diff(x(t), t))*cos(t)*sin(t))*(diff(diff(x(t), t), t))-(diff(x(t), t))^6*sin(t)^2-(diff(x(t), t))^6*cos(t)^2+2*(diff(x(t), t))^4*sin(t)^2+(diff(x(t), t))^4*cos(t)^2-(diff(x(t), t))^2*sin(t)^2)/(x(t)^2-2*x(t)*cos(t)+cos(t)^2)}, {y(t) = (-(diff(x(t), t))^3*x(t)*sin(t)+(diff(x(t), t))*x(t)*sin(t)-(diff(x(t), t))*cos(t)*sin(t)-(diff(diff(x(t), t), t))*x(t)^2+2*(diff(diff(x(t), t), t))*x(t)*cos(t)-(diff(diff(x(t), t), t))*cos(t)^2)/((diff(x(t), t))^3*cos(t))}, {lambda(t) = (-x(t)+cos(t))/(diff(x(t), t))}]

Use the interactive feature of dsolve to sample different initial conditions and record cases where the separation at t = 50 is less than 0.05.

ansnum(initial)

[t = HFloat(0.0), x(t) = HFloat(5.0), y(t) = HFloat(0.5), lambda(t) = HFloat(4.03112887414927), X(t) = HFloat(1.0), diff(X(t), t) = HFloat(0.0), Y(t) = HFloat(0.0), diff(Y(t), t) = HFloat(-1.0)]

xv := Vector(0):
yv := Vector(0):
for x__0 from -2.1 to 2.1 by 0.2 do for y__0 from 0 to 2 by 0.2 do
  ansnum(initial = [0., x__0, y__0, eval(sqrt((1 - x)^2 + y^2), {x = x__0, y = y__0}) ,1., 0., 0., -1.]);
  if eval(sqrt((x(t) - X(t))^2 + (y(t) - Y(t))^2), ansnum(50.)) < 0.05 then
    xv ,= x__0;
    yv ,= y__0
  end if
end do end do:

A point here indicates the wolf (effectively) catches the goat if starting from this point. It seems the wolf always catches the goat

display(plots:-pointplot(xv, yv), plot([cos(t), -sin(t), t = Pi .. 2*Pi], color = blue), scaling = constrained)

 

NULL

Download pursuit3.mw

I don't see any problem here - if aleph goes to zero, then the coefficient in front of the Jacobi function goes to zero and the whole function goes to zero. An uninteresting solution in that case.

restart

with(PDEtools)

with(LinearAlgebra)

with(Physics)

with(SolveTools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

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

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

ode1 := subs({lambda[1] = 0, lambda[3] = 0}, ode)

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

First one of result 2

S1 := G(xi) = sqrt(-aleph^2*lambda[2]/((2*aleph^2-1)*lambda[4]))*JacobiCN(sqrt(lambda[2]/(2*aleph^2-1))*xi, aleph)

G(xi) = (-aleph^2*lambda[2]/((2*aleph^2-1)*lambda[4]))^(1/2)*JacobiCN((lambda[2]/(2*aleph^2-1))^(1/2)*xi, aleph)

The following gives lambda[0] differing by a sign from in the paper (aleph^2-1) instead of 1-aleph^2 in the numerator

res1 := `assuming`([odetest(S1, ode1)], [lambda[2] > 0, lambda[4] < 0]); eq1 := lambda[0] = factor(solve(res1, lambda[0]))

-4*aleph^4*lambda[0]/(4*aleph^4-4*aleph^2+1)+aleph^4*lambda[2]^2/((4*aleph^4-4*aleph^2+1)*lambda[4])+4*aleph^2*lambda[0]/(4*aleph^4-4*aleph^2+1)-lambda[2]^2*aleph^2/((4*aleph^4-4*aleph^2+1)*lambda[4])-lambda[0]/(4*aleph^4-4*aleph^2+1)

lambda[0] = lambda[2]^2*aleph^2*(aleph-1)*(aleph+1)/((2*aleph^2-1)^2*lambda[4])

`assuming`([odetest(S1, eval(ode1, eq1))], [lambda[2] > 0, lambda[4] < 0])

0

Case of aleph = 1

S1b := eval(S1, aleph = 1)

G(xi) = (-lambda[2]/lambda[4])^(1/2)*sech(lambda[2]^(1/2)*xi)

eq1b := eval(eq1, aleph = 1)

lambda[0] = 0

`assuming`([odetest(S1b, eval(ode1, eq1b))], [lambda[2] > 0, lambda[4] < 0])

0

Case of aleph = 0 - here the coefficient goes to zero so the whole thing does.

S1c := eval(S1, aleph = 0)

G(xi) = 0

Just looking at the JacobiCN part, it goes to cos as expected.

select(has, rhs(S1), JacobiCN); eval(%, aleph = 0)

JacobiCN((lambda[2]/(2*aleph^2-1))^(1/2)*xi, aleph)

cos((-lambda[2])^(1/2)*xi)

series(rhs(S1), aleph)

Error, (in series/function) unable to compute series

Note the following is imaginary.

eval(S1, {aleph = 0.1e-4, xi = 1, lambda[2] = 1, lambda[4] = -1})

G(1) = -0.+0.1543080635e-4*I

Go back to the ode

ode1

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

ans := sort([dsolve(ode1, G(xi))])[1]

G(xi) = 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)

eq0 := lambda[0] = solve(aleph = 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), lambda[0])

lambda[0] = aleph^2*lambda[2]^2/((aleph^2+1)^2*lambda[4])

This form with sn is close, but not sure about the right signs for assumptions to get this result without symbolic

ans2 := simplify(eval(ans, {eq0, c__1 = 0}), symbolic)

G(xi) = -I*lambda[2]^(1/2)*aleph*JacobiSN(I*lambda[2]^(1/2)*xi/(aleph^2+1)^(1/2), aleph)/((aleph^2+1)^(1/2)*lambda[4]^(1/2))

NULL

Download test.mw

It should be simpler to draw the results once r is found, but the geometry package uses attributes, which makes this non-trivial, e.g. eval(k3, rr=r) doesn't work, nor does assigning r:=rr;.

restart

with(plots); with(geometry)

Circles k1 and k2 have radii 1 and sqrt(2), centred WLOG at the origin.

point(o, [0, 0]); circle(k1, [o, 1]); circle(k2, [o, sqrt(2)])

"From the outside, five congruent circles k3 are placed tangent to k1, each with a radius r yet to be calculated."
WLOG take centre of one k3 circle at [1+r, 0]

assume(r > sqrt(2)-1); point(k3c, [1+r, 0]); circle(k3, [k3c, r])

Find the intersection points p1 and p2 between circles k2 and k3

intersection('P', k2, k3, [p1, p2])

[p1, p2]

coordinates(p1)

[-(-2-(1+r)^2+r^2)/(2+2*r), (-(-2-(1+r)^2+r^2)^2/(2+2*r)^2+(-2-2*r)*(-2-(1+r)^2+r^2)/(2+2*r)-(1+r)^2+r^2)^(1/2)]

Find the angle p1-o-k3c

ang := FindAngle(line(horiz, [o, k3c]), line(op1, [o, p1]))

-arctan((-(-2-(1+r)^2+r^2)^2/(2+2*r)^2+(-2-2*r)*(-2-(1+r)^2+r^2)/(2+2*r)-(1+r)^2+r^2)^(1/2)*(2+2*r)/(-2-(1+r)^2+r^2))

This angle needs to be 2*Pi/10, and we can solve for r.

ans := sort([solve(ang = 2*Pi*(1/10), r)])

Warning, solve may be ignoring assumptions on the input variables.

[-(1/2)*(3*tan((1/5)*Pi)^2-(2*tan((1/5)*Pi)^2+2)^(1/2)-1)/(tan((1/5)*Pi)^2-1), -(1/2)*(3*tan((1/5)*Pi)^2+(2*tan((1/5)*Pi)^2+2)^(1/2)-1)/(tan((1/5)*Pi)^2-1)]

rr := evala(convert(ans[2], radical))

-1/2+(1/2)*5^(1/2)+(3/4)*2^(1/2)+(1/4)*5^(1/2)*2^(1/2)

Update these objects to reflect the calculated value of r.

setattribute(k3c, eval(attributes(k3c), r = rr)); setattribute(k3, eval(attributes(k3), r = rr)); setattribute(p1, eval(attributes(p1), r = rr))

k3c

k3

p1

draw([o, k1, k2(color = blue), k3(color = black), p1], printtext = true, axes = none)

NULL

Download circles.mw

I don't know exactly how to do the linearization, and none of the papers you sent me offline relate to that. But the dispersion analysis is straightforward; you could type in the version of Eq 11 in the paper and see if the rest carries through.

restart

with(PDEtools); with(LinearAlgebra)

undeclare(prime, quiet)

declare(u(x, t), quiet); declare(U(x, t), quiet); declare(theta(x, t), quiet)

_local(gamma)

I changed the part in red - correct?

pde := Diff(u(x, t), `$`(t, 2))-s^2*(Diff(u(x, t), `$`(x, 2)))+(2*I)*(Diff(u(x, t)*U^2, t))-(2*I)*alpha*s*(Diff(u(x, t)*U^2, x))+I*(Diff(u(x, t), `$`(x, 2), t))-I*beta*s*(diff(u(x, t), `$`(x, 3)))

Diff(u(x, t), t, t)-s^2*(Diff(u(x, t), x, x))+(2*I)*(Diff(u(x, t)*U^2, t))-(2*I)*alpha*s*(Diff(u(x, t)*U^2, x))+I*(Diff(u(x, t), x, x, t))-I*beta*s*(diff(diff(diff(u(x, t), x), x), x))

T := u(x, t) = (sqrt(Q)+theta(x, t))*exp(I*(Q^2*epsilon*gamma+Q*q)*t); T1 := U = sqrt(Q)+theta(x, t)

u(x, t) = (Q^(1/2)+theta(x, t))*exp(I*(Q^2*epsilon*gamma+Q*q)*t)

U = Q^(1/2)+theta(x, t)

Check it looks correct.

subs({T, T1}, pde); pde2 := value(%)

Diff((Q^(1/2)+theta(x, t))*exp(I*(Q^2*epsilon*gamma+Q*q)*t), t, t)-s^2*(Diff((Q^(1/2)+theta(x, t))*exp(I*(Q^2*epsilon*gamma+Q*q)*t), x, x))+(2*I)*(Diff((Q^(1/2)+theta(x, t))^3*exp(I*(Q^2*epsilon*gamma+Q*q)*t), t))-(2*I)*alpha*s*(Diff((Q^(1/2)+theta(x, t))^3*exp(I*(Q^2*epsilon*gamma+Q*q)*t), x))+I*(Diff((Q^(1/2)+theta(x, t))*exp(I*(Q^2*epsilon*gamma+Q*q)*t), x, x, t))-I*beta*s*(diff(diff(diff((Q^(1/2)+theta(x, t))*exp(I*(Q^2*epsilon*gamma+Q*q)*t), x), x), x))

(diff(diff(theta(x, t), t), t))*exp(I*(Q^2*epsilon*gamma+Q*q)*t)+(2*I)*(diff(theta(x, t), t))*(Q^2*epsilon*gamma+Q*q)*exp(I*(Q^2*epsilon*gamma+Q*q)*t)-(Q^(1/2)+theta(x, t))*(Q^2*epsilon*gamma+Q*q)^2*exp(I*(Q^2*epsilon*gamma+Q*q)*t)-s^2*(diff(diff(theta(x, t), x), x))*exp(I*(Q^2*epsilon*gamma+Q*q)*t)+(2*I)*(3*(Q^(1/2)+theta(x, t))^2*exp(I*(Q^2*epsilon*gamma+Q*q)*t)*(diff(theta(x, t), t))+I*(Q^(1/2)+theta(x, t))^3*(Q^2*epsilon*gamma+Q*q)*exp(I*(Q^2*epsilon*gamma+Q*q)*t))-(6*I)*alpha*s*(Q^(1/2)+theta(x, t))^2*exp(I*(Q^2*epsilon*gamma+Q*q)*t)*(diff(theta(x, t), x))+I*((diff(diff(diff(theta(x, t), t), x), x))*exp(I*(Q^2*epsilon*gamma+Q*q)*t)+I*(diff(diff(theta(x, t), x), x))*(Q^2*epsilon*gamma+Q*q)*exp(I*(Q^2*epsilon*gamma+Q*q)*t))-I*beta*s*(diff(diff(diff(theta(x, t), x), x), x))*exp(I*(Q^2*epsilon*gamma+Q*q)*t)

P := collect(pde2, exp)/exp(I*(Q^2*gamma*`&epsilon;`+Q*q)*t)

diff(diff(theta(x, t), t), t)+(2*I)*(diff(theta(x, t), t))*(Q^2*epsilon*gamma+Q*q)-(Q^(1/2)+theta(x, t))*(Q^2*epsilon*gamma+Q*q)^2-s^2*(diff(diff(theta(x, t), x), x))+(2*I)*(3*(Q^(1/2)+theta(x, t))^2*(diff(theta(x, t), t))+I*(Q^(1/2)+theta(x, t))^3*(Q^2*epsilon*gamma+Q*q))-(6*I)*alpha*s*(Q^(1/2)+theta(x, t))^2*(diff(theta(x, t), x))+I*(diff(diff(diff(theta(x, t), t), x), x)+I*(diff(diff(theta(x, t), x), x))*(Q^2*epsilon*gamma+Q*q))-I*beta*s*(diff(diff(diff(theta(x, t), x), x), x))

This needs to be linearized with respect to theta. I'll just throw away second and higher order terms in theta. We can't use coeff on theta(x,t), so will do it in jet notation.

PJ := expand(subs(theta[] = F, ToJet(P, theta(x, t), jetnotation = jetvariableswithbrackets))); P2 := FromJet(subs(F = theta[], remove(proc (q) options operator, arrow; 1 < degree(q, F) end proc, PJ)), theta(x, t))

-s^2*(diff(diff(theta(x, t), x), x))-Q^(5/2)*q^2-2*Q^(5/2)*q+(2*I)*(diff(theta(x, t), t))*Q^2*epsilon*gamma-(6*I)*alpha*s*(diff(theta(x, t), x))*Q-(diff(diff(theta(x, t), x), x))*Q^2*epsilon*gamma-6*Q^3*theta(x, t)*epsilon*gamma+(6*I)*(diff(theta(x, t), t))*Q+(12*I)*(diff(theta(x, t), t))*Q^(1/2)*theta(x, t)-2*Q^(7/2)*epsilon*gamma*q-theta(x, t)*Q^4*epsilon^2*gamma^2+diff(diff(theta(x, t), t), t)-I*beta*s*(diff(diff(diff(theta(x, t), x), x), x))+(2*I)*(diff(theta(x, t), t))*Q*q-(12*I)*alpha*s*(diff(theta(x, t), x))*Q^(1/2)*theta(x, t)-2*theta(x, t)*Q^3*epsilon*gamma*q-Q^(9/2)*epsilon^2*gamma^2-theta(x, t)*Q^2*q^2-2*Q^(7/2)*epsilon*gamma-6*Q^2*theta(x, t)*q+I*(diff(diff(diff(theta(x, t), t), x), x))-(diff(diff(theta(x, t), x), x))*Q*q

But we still have half-integral powers of Q, which don't appear in Eq, 11. So there is definitely something wrong something I'm doing here.
If I manually remove any terms with half integral powers of Q, I'm left with something that is still not right - there are the right number of terms but there is no term with coefficient 18

P3 := -6*Q^2*q*theta(x, t)-theta(x, t)*Q^2*q^2-(diff(diff(theta(x, t), x), x))*Q^2*`&epsilon;`*gamma+(6*I)*(diff(theta(x, t), t))*Q-theta(x, t)*Q^4*`&epsilon;`^2*gamma^2-6*Q^3*`&epsilon;`*gamma*theta(x, t)+(2*I)*(diff(theta(x, t), t))*Q*q-(diff(diff(theta(x, t), x), x))*Q*q-I*beta*s*(diff(diff(diff(theta(x, t), x), x), x))-s^2*(diff(diff(theta(x, t), x), x))+(2*I)*(diff(theta(x, t), t))*Q^2*`&epsilon;`*gamma-(6*I)*alpha*s*(diff(theta(x, t), x))*Q+I*(diff(diff(theta(x, t), t, x), x))-2*theta(x, t)*Q^3*`&epsilon;`*gamma*q+diff(diff(theta(x, t), t), t); nops(%)

-6*Q^2*theta(x, t)*q-theta(x, t)*Q^2*q^2-(diff(diff(theta(x, t), x), x))*Q^2*epsilon*gamma+(6*I)*(diff(theta(x, t), t))*Q-theta(x, t)*Q^4*epsilon^2*gamma^2-6*Q^3*theta(x, t)*epsilon*gamma+(2*I)*(diff(theta(x, t), t))*Q*q-(diff(diff(theta(x, t), x), x))*Q*q-I*beta*s*(diff(diff(diff(theta(x, t), x), x), x))-s^2*(diff(diff(theta(x, t), x), x))+(2*I)*(diff(theta(x, t), t))*Q^2*epsilon*gamma-(6*I)*alpha*s*(diff(theta(x, t), x))*Q+I*(diff(diff(diff(theta(x, t), t), x), x))-2*theta(x, t)*Q^3*epsilon*gamma*q+diff(diff(theta(x, t), t), t)

15

So I'll just proceed with the above incorrect result

We assume theta has the form

TT := theta(x, t) = alpha[1]*exp(I*(k*x-t*w))+alpha[2]*exp(-I*(k*x-t*w))

theta(x, t) = alpha[1]*exp(I*(k*x-t*w))+alpha[2]*exp(-I*(k*x-t*w))

We substitute this in P3 and collect the coefficients of the two exp terms

P4 := collect(eval(P3, TT), exp); indets(%)

(-Q^4*epsilon^2*gamma^2*alpha[2]-2*Q^3*epsilon*gamma*q*alpha[2]+Q^2*epsilon*gamma*k^2*alpha[2]-6*Q^3*epsilon*gamma*alpha[2]-2*Q^2*epsilon*gamma*w*alpha[2]+beta*k^3*s*alpha[2]-Q^2*q^2*alpha[2]-6*Q*alpha*k*s*alpha[2]+Q*k^2*q*alpha[2]+k^2*s^2*alpha[2]-6*Q^2*q*alpha[2]-2*Q*q*w*alpha[2]+k^2*w*alpha[2]-6*Q*w*alpha[2]-w^2*alpha[2])*exp(-I*(k*x-t*w))+(-Q^4*epsilon^2*gamma^2*alpha[1]-2*Q^3*epsilon*gamma*q*alpha[1]+Q^2*epsilon*gamma*k^2*alpha[1]-6*Q^3*epsilon*gamma*alpha[1]+2*Q^2*epsilon*gamma*w*alpha[1]-beta*k^3*s*alpha[1]-Q^2*q^2*alpha[1]+6*Q*alpha*k*s*alpha[1]+Q*k^2*q*alpha[1]+k^2*s^2*alpha[1]-6*Q^2*q*alpha[1]+2*Q*q*w*alpha[1]-k^2*w*alpha[1]+6*Q*w*alpha[1]-w^2*alpha[1])*exp(I*(k*x-t*w))

{Q, alpha, beta, epsilon, gamma, k, q, s, t, w, x, alpha[1], alpha[2], exp(-I*(k*x-t*w)), exp(I*(k*x-t*w))}

subs({exp(-I*(k*x-t*w)) = X, exp(I*(k*x-t*w)) = Y}, P4); eqs := [coeff(%, X), coeff(%, Y)]

[-Q^4*epsilon^2*gamma^2*alpha[2]-2*Q^3*epsilon*gamma*q*alpha[2]+Q^2*epsilon*gamma*k^2*alpha[2]-6*Q^3*epsilon*gamma*alpha[2]-2*Q^2*epsilon*gamma*w*alpha[2]+beta*k^3*s*alpha[2]-Q^2*q^2*alpha[2]-6*Q*alpha*k*s*alpha[2]+Q*k^2*q*alpha[2]+k^2*s^2*alpha[2]-6*Q^2*q*alpha[2]-2*Q*q*w*alpha[2]+k^2*w*alpha[2]-6*Q*w*alpha[2]-w^2*alpha[2], -Q^4*epsilon^2*gamma^2*alpha[1]-2*Q^3*epsilon*gamma*q*alpha[1]+Q^2*epsilon*gamma*k^2*alpha[1]-6*Q^3*epsilon*gamma*alpha[1]+2*Q^2*epsilon*gamma*w*alpha[1]-beta*k^3*s*alpha[1]-Q^2*q^2*alpha[1]+6*Q*alpha*k*s*alpha[1]+Q*k^2*q*alpha[1]+k^2*s^2*alpha[1]-6*Q^2*q*alpha[1]+2*Q*q*w*alpha[1]-k^2*w*alpha[1]+6*Q*w*alpha[1]-w^2*alpha[1]]

Set up these as matrix equations in the unknowns alpha[1] and alpha[2]

M, b := GenerateMatrix(eqs, [alpha[1], alpha[2]])

Matrix(%id = 36893489719865696116), Vector[column](%id = 36893489719865695996)

There is a nontrivial solution to these equations iff the determinant is zero. The determinant is a quartic in w.

detM := Determinant(M)

-(Q^4*epsilon^2*gamma^2+2*Q^3*epsilon*gamma*q-Q^2*epsilon*gamma*k^2+6*Q^3*epsilon*gamma+2*Q^2*epsilon*gamma*w-beta*k^3*s+Q^2*q^2+6*Q*alpha*k*s-Q*k^2*q-k^2*s^2+6*Q^2*q+2*Q*q*w-k^2*w+6*Q*w+w^2)*(Q^4*epsilon^2*gamma^2+2*Q^3*epsilon*gamma*q-Q^2*epsilon*gamma*k^2+6*Q^3*epsilon*gamma-2*Q^2*epsilon*gamma*w+beta*k^3*s+Q^2*q^2-6*Q*alpha*k*s-Q*k^2*q-k^2*s^2+6*Q^2*q-2*Q*q*w+k^2*w-6*Q*w+w^2)

And we solve for w to define the dispersion relationship eq 13. The coefficients under the square roots aren't correct, but presumably would be if P3 were correct. The first two solutions seem to be the ones of interest.

ans := sort([solve(detM, w)])

[-Q^2*epsilon*gamma-Q*q+(1/2)*k^2-3*Q-(1/2)*(4*beta*k^3*s-24*Q*alpha*k*s+k^4+4*k^2*s^2-12*Q*k^2+36*Q^2)^(1/2), -Q^2*epsilon*gamma-Q*q+(1/2)*k^2-3*Q+(1/2)*(4*beta*k^3*s-24*Q*alpha*k*s+k^4+4*k^2*s^2-12*Q*k^2+36*Q^2)^(1/2), Q^2*epsilon*gamma+Q*q-(1/2)*k^2+3*Q-(1/2)*(-4*beta*k^3*s+24*Q*alpha*k*s+k^4+4*k^2*s^2-12*Q*k^2+36*Q^2)^(1/2), Q^2*epsilon*gamma+Q*q-(1/2)*k^2+3*Q+(1/2)*(-4*beta*k^3*s+24*Q*alpha*k*s+k^4+4*k^2*s^2-12*Q*k^2+36*Q^2)^(1/2)]

w is real when the expression under the square root is positive

ans[1]

-Q^2*epsilon*gamma-Q*q+(1/2)*k^2-3*Q-(1/2)*(4*beta*k^3*s-24*Q*alpha*k*s+k^4+4*k^2*s^2-12*Q*k^2+36*Q^2)^(1/2)

(-numer(op(-1, ans[1])))^2

4*beta*k^3*s-24*Q*alpha*k*s+k^4+4*k^2*s^2-12*Q*k^2+36*Q^2

NULL

Download steps.mw

For conditions with <>, just leave them out. They are just assumptions that will prevent the denominator being zero.

Do the equation assumptions as substitutions as you did, but then you do not need them as assumptions. Minor corrections noted on the worksheet.

ode-17.mw

 

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