dharr

Dr. David Harrington

8430 Reputation

22 Badges

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

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

 

Here is how to do coupled equations for the Hirota-Satsuma system. The reference seems the clearest about the algorithm, though I didn't understand how they decided on the a=1/2 condition. For the Schroedinger equation there were equations and not simple integers for the resonant points and I got many, but not all of the results - see schrodinger-test.mw.

Painleve analysis following the notation in doi: 10.2991/jnmp.2006.13.1.8

Hirota-Satsuma system example from that paper.

restart

with(PDEtools); with(LinearAlgebra)

undeclare(prime, quiet)

vars := x, t; declare(u(vars), quiet); declare(v(vars), quiet); declare(g(vars), quiet); declare(U(vars), quiet); declare(V(vars), quiet)

pde1 := a*(6*u(x, t)*(diff(u(x, t), x))+diff(u(x, t), x, x, x))-2*v(x, t)*(diff(v(x, t), x))-(diff(u(x, t), t)); pde2 := -3*u(x, t)*(diff(v(x, t), x))-(diff(v(x, t), `$`(x, 3)))-(diff(v(x, t), t))

a*(6*u(x, t)*(diff(u(x, t), x))+diff(diff(diff(u(x, t), x), x), x))-2*v(x, t)*(diff(v(x, t), x))-(diff(u(x, t), t))

-3*u(x, t)*(diff(v(x, t), x))-(diff(diff(diff(v(x, t), x), x), x))-(diff(v(x, t), t))

depvars := [u(vars), v(vars), g(vars)]

[u(x, t), v(x, t), g(x, t)]

findexp := proc (T) options operator, arrow; simplify(g(vars)*Physics:-diff(T, g(vars))/T) end proc

Step 1

eq31u := u(vars) = chi[1]*g(vars)^alpha[1]; eq31v := v(vars) = chi[2]*g(vars)^alpha[2]

u(x, t) = chi[1]*g(x, t)^alpha[1]

v(x, t) = chi[2]*g(x, t)^alpha[2]

eqG1 := expand(eval(pde1, {eq31u, eq31v})); eqG2 := expand(eval(pde2, {eq31u, eq31v}))

6*a*chi[1]^2*(g(x, t)^alpha[1])^2*alpha[1]*(diff(g(x, t), x))/g(x, t)+a*chi[1]*g(x, t)^alpha[1]*alpha[1]^3*(diff(g(x, t), x))^3/g(x, t)^3+3*a*chi[1]*g(x, t)^alpha[1]*alpha[1]^2*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))/g(x, t)^2-3*a*chi[1]*g(x, t)^alpha[1]*alpha[1]^2*(diff(g(x, t), x))^3/g(x, t)^3+a*chi[1]*g(x, t)^alpha[1]*alpha[1]*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)-3*a*chi[1]*g(x, t)^alpha[1]*alpha[1]*(diff(diff(g(x, t), x), x))*(diff(g(x, t), x))/g(x, t)^2+2*a*chi[1]*g(x, t)^alpha[1]*alpha[1]*(diff(g(x, t), x))^3/g(x, t)^3-2*chi[2]^2*(g(x, t)^alpha[2])^2*alpha[2]*(diff(g(x, t), x))/g(x, t)-chi[1]*g(x, t)^alpha[1]*alpha[1]*(diff(g(x, t), t))/g(x, t)

-3*chi[1]*g(x, t)^alpha[1]*chi[2]*g(x, t)^alpha[2]*alpha[2]*(diff(g(x, t), x))/g(x, t)-chi[2]*g(x, t)^alpha[2]*alpha[2]^3*(diff(g(x, t), x))^3/g(x, t)^3-3*chi[2]*g(x, t)^alpha[2]*alpha[2]^2*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))/g(x, t)^2+3*chi[2]*g(x, t)^alpha[2]*alpha[2]^2*(diff(g(x, t), x))^3/g(x, t)^3-chi[2]*g(x, t)^alpha[2]*alpha[2]*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)+3*chi[2]*g(x, t)^alpha[2]*alpha[2]*(diff(diff(g(x, t), x), x))*(diff(g(x, t), x))/g(x, t)^2-2*chi[2]*g(x, t)^alpha[2]*alpha[2]*(diff(g(x, t), x))^3/g(x, t)^3-chi[2]*g(x, t)^alpha[2]*alpha[2]*(diff(g(x, t), t))/g(x, t)

Find all the distinct powers of g for eqG1 and eqG2

exps1 := [(`minus`(map(findexp, {op(eqG1+forceplus)}), {0}))[]]; exps2 := [(`minus`(map(findexp, {op(eqG2+forceplus)}), {0}))[]]

[-2+alpha[1], alpha[1]-3, alpha[1]-1, 2*alpha[1]-1, 2*alpha[2]-1]

[-2+alpha[2], alpha[2]-3, alpha[2]-1, alpha[1]+alpha[2]-1]

Find the slopes wrt alpha[1] and alpha[2] and separate into categories based on the different pairs of slopes. Then find the lowest lines for each case.

mins1 := `~`[min](convert(ListTools:-Classify(proc (q) options operator, arrow; [diff(q, alpha[1]), diff(q, alpha[2])] end proc, exps1), list)); mins2 := `~`[min](convert(ListTools:-Classify(proc (q) options operator, arrow; [diff(q, alpha[1]), diff(q, alpha[2])] end proc, exps2), list))

[2*alpha[2]-1, 2*alpha[1]-1, alpha[1]-3]

[alpha[1]+alpha[2]-1, alpha[2]-3]

Find all intersection points between pairs of these. Each is a list of a set of the alpha values and then the corresponding exponent.

"intersections1:={seq(seq([(ans:=solve(mins1[i]=mins1[j],{alpha[1],alpha[2]})),eval(mins1[i],ans)],i=1..j-1),j=1..nops(mins1))}; intersections2:={seq(seq([(ans:=solve(mins2[i]=mins2[j],{alpha[1],alpha[2]})),eval(mins2[i],ans)],i=1..j-1),j=1..nops(mins2))};"

{[{alpha[1] = -2, alpha[2] = alpha[2]}, -5], [{alpha[1] = alpha[2], alpha[2] = alpha[2]}, 2*alpha[2]-1], [{alpha[1] = 2*alpha[2]+2, alpha[2] = alpha[2]}, 2*alpha[2]-1]}

{[{alpha[1] = -2, alpha[2] = alpha[2]}, alpha[2]-3]}

When an alpha is undetermined, then the algoritm says put successive integers in and accept a possibility (branch) if each equation has at least two leading (most negative) terms.
There is only one solution to the second case, which sets alpha[1] = -2 but doesn't fix alpha[2]. This is also the first solution in the first case, which corresponds to leading order -5.

If we put it into the second solution in the first case, i.e. alpha[1]=alpha[2]=-2, then the order is 2*alpha[2] - 1 = -5.
If we put it into the third solution in the first case, i.e. alpha[1]=2+2*alpha[2], or -2 = 2+2*alpha[2] or alpha[2] = -2 and the leading order is 2*alpha[2] - 1 = -5.
So alpha[1] = alpha[2] = -2 will work in any case.
Note that alpha[2]>-2 will also work with -5 (we need at least two in each equation having -5)

eval(mins1, {alpha[1] = -2, alpha[2] = -1}); eval(mins2, {alpha[1] = -2, alpha[2] = -1})

[-3, -5, -5]

[-4, -4]

But alpha[2] <-2 won't work - here we have only one of leading order -7 (we have two -5s, but these aren't the most negative).

eval(mins1, {alpha[1] = -2, alpha[2] = -3}); eval(mins2, {alpha[1] = -2, alpha[2] = -3})

[-7, -5, -5]

[-6, -6]


Apparently, alpha[1]=-2, alpha[2]>=0 leads to u[0] or v[0] identically 0, so is excluded. So we have two possibilities (need integers or have to do a special analysis):

b1 := {alpha[1] = -2, alpha[2] = -2}; b2 := {alpha[1] = -2, alpha[2] = -1}

{alpha[1] = -2, alpha[2] = -2}

{alpha[1] = -2, alpha[2] = -1}

Start with the b1 case

eqb := b1

{alpha[1] = -2, alpha[2] = -2}

eq32b := eval({u(vars) = chi[1]*g(vars)^alpha[1], v(vars) = chi[2]*g(vars)^alpha[2]}, eqb)

{u(x, t) = chi[1]/g(x, t)^2, v(x, t) = chi[2]/g(x, t)^2}

 

eq32b := expand(eval([pde1, pde2], eq32b))

[-12*a*chi[1]^2*(diff(g(x, t), x))/g(x, t)^5-24*a*chi[1]*(diff(g(x, t), x))^3/g(x, t)^5+18*a*chi[1]*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))/g(x, t)^4-2*a*chi[1]*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)^3+4*chi[2]^2*(diff(g(x, t), x))/g(x, t)^5+2*chi[1]*(diff(g(x, t), t))/g(x, t)^3, 6*chi[1]*chi[2]*(diff(g(x, t), x))/g(x, t)^5+24*chi[2]*(diff(g(x, t), x))^3/g(x, t)^5-18*chi[2]*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))/g(x, t)^4+2*chi[2]*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)^3+2*chi[2]*(diff(g(x, t), t))/g(x, t)^3]

We want only the terms with g^(mindeg), but we cannot collect wrt g, so convert it to a simple name before collecting

eq32c := subs(g[] = G, ToJet(eq32b, depvars, jetnotation = jetvariableswithbrackets))

[-12*a*chi[1]^2*g[x]/G^5-24*a*chi[1]*g[x]^3/G^5+18*a*chi[1]*g[x]*g[x, x]/G^4-2*a*chi[1]*g[x, x, x]/G^3+4*chi[2]^2*g[x]/G^5+2*chi[1]*g[t]/G^3, 6*chi[1]*chi[2]*g[x]/G^5+24*chi[2]*g[x]^3/G^5-18*chi[2]*g[x]*g[x, x]/G^4+2*chi[2]*g[x, x, x]/G^3+2*chi[2]*g[t]/G^3]

`~`[ldegree](eq32c, G); mindeg1, mindeg2 := %[]

[-5, -5]

-5, -5

S1 := FromJet(coeff(collect(eq32c[1], G), G, mindeg1), depvars); S2 := FromJet(coeff(collect(eq32c[2], G), G, mindeg1), depvars)

-24*a*chi[1]*(diff(g(x, t), x))^3-12*a*chi[1]^2*(diff(g(x, t), x))+4*chi[2]^2*(diff(g(x, t), x))

24*chi[2]*(diff(g(x, t), x))^3+6*chi[1]*chi[2]*(diff(g(x, t), x))

solve({S1, S2, chi[1] <> 0, chi[2] <> 0}, {chi[1], chi[2]}, explicit); eqchi := %[1]

{chi[1] = -4*(diff(g(x, t), x))^2, chi[2] = 2*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2}, {chi[1] = -4*(diff(g(x, t), x))^2, chi[2] = -2*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2}

{chi[1] = -4*(diff(g(x, t), x))^2, chi[2] = 2*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2}

Following are u[0]/g^alpha[1] and v[0]/g^alpha[2], which we use in step 2 - Eq 3.19 (1)

eq19ub := rhs(eval(eq31u, `union`(eqchi, eqb))); eq19vb := rhs(eval(eq31v, `union`(eqchi, eqb)))

-4*(diff(g(x, t), x))^2/g(x, t)^2

2*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2/g(x, t)^2

So we found (chi) and (alpha) which was our target for first step

Step 2 - finding resonance points. use U as short for u_j

equr := u(vars) = eq19ub+eval(U(vars)*g(vars)^(r+alpha[1]), eqb); eqvr := v(vars) = eq19vb+eval(V(vars)*g(vars)^(r+alpha[2]), eqb)

u(x, t) = -4*(diff(g(x, t), x))^2/g(x, t)^2+U(x, t)*g(x, t)^(r-2)

v(x, t) = 2*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2/g(x, t)^2+V(x, t)*g(x, t)^(r-2)

We substitute into the pdes, and seek "the coefficients of the dominant terms",

eqr1 := expand(eval(pde1, {equr, eqvr})); eqr2 := expand(eval(pde2, {equr, eqvr}))

8*(diff(g(x, t), x))*(diff(diff(g(x, t), t), x))/g(x, t)^2-8*(diff(g(x, t), x))^2*(diff(g(x, t), t))/g(x, t)^3-15*a*U(x, t)*g(x, t)^r*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))*r/g(x, t)^4+3*a*U(x, t)*g(x, t)^r*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))*r^2/g(x, t)^4-4*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r*r/g(x, t)^5-8*V(x, t)*g(x, t)^r*6^(1/2)*a^(1/2)*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))/g(x, t)^4+a*U(x, t)*g(x, t)^r*(diff(diff(diff(g(x, t), x), x), x))*r/g(x, t)^3+3*a*(diff(diff(U(x, t), x), x))*g(x, t)^r*(diff(g(x, t), x))*r/g(x, t)^3+3*a*(diff(U(x, t), x))*g(x, t)^r*(diff(diff(g(x, t), x), x))*r/g(x, t)^3+3*a*(diff(g(x, t), x))^2*(diff(U(x, t), x))*g(x, t)^r*r^2/g(x, t)^4-15*a*(diff(g(x, t), x))^2*(diff(U(x, t), x))*g(x, t)^r*r/g(x, t)^4+a*(diff(g(x, t), x))^3*U(x, t)*g(x, t)^r*r^3/g(x, t)^5-9*a*(diff(g(x, t), x))^3*U(x, t)*g(x, t)^r*r^2/g(x, t)^5+2*a*(diff(g(x, t), x))^3*U(x, t)*g(x, t)^r*r/g(x, t)^5-30*a*U(x, t)*g(x, t)^r*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))/g(x, t)^4+6*a*U(x, t)^2*(g(x, t)^r)^2*(diff(g(x, t), x))*r/g(x, t)^5-4*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2*(diff(V(x, t), x))*g(x, t)^r/g(x, t)^4+16*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r/g(x, t)^5+2*U(x, t)*g(x, t)^r*(diff(g(x, t), t))/g(x, t)^3-(diff(U(x, t), t))*g(x, t)^r/g(x, t)^2-24*a*(diff(diff(g(x, t), x), x))*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)^2+96*a*(diff(diff(g(x, t), x), x))^2*(diff(g(x, t), x))/g(x, t)^3+56*a*(diff(g(x, t), x))^2*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)^3-8*a*(diff(g(x, t), x))*(diff(diff(diff(diff(g(x, t), x), x), x), x))/g(x, t)^2+a*(diff(diff(diff(U(x, t), x), x), x))*g(x, t)^r/g(x, t)^2-120*a*(diff(g(x, t), x))^3*(diff(diff(g(x, t), x), x))/g(x, t)^4-2*V(x, t)*(g(x, t)^r)^2*(diff(V(x, t), x))/g(x, t)^4+4*V(x, t)^2*(g(x, t)^r)^2*(diff(g(x, t), x))/g(x, t)^5-U(x, t)*g(x, t)^r*(diff(g(x, t), t))*r/g(x, t)^3-2*a*U(x, t)*g(x, t)^r*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)^3-6*a*(diff(diff(U(x, t), x), x))*g(x, t)^r*(diff(g(x, t), x))/g(x, t)^3-6*a*(diff(U(x, t), x))*g(x, t)^r*(diff(diff(g(x, t), x), x))/g(x, t)^3-6*a*(diff(g(x, t), x))^2*(diff(U(x, t), x))*g(x, t)^r/g(x, t)^4+72*a*(diff(g(x, t), x))^3*U(x, t)*g(x, t)^r/g(x, t)^5+6*a*U(x, t)*(g(x, t)^r)^2*(diff(U(x, t), x))/g(x, t)^4-12*a*U(x, t)^2*(g(x, t)^r)^2*(diff(g(x, t), x))/g(x, t)^5-2*V(x, t)^2*(g(x, t)^r)^2*(diff(g(x, t), x))*r/g(x, t)^5

12*U(x, t)*g(x, t)^r*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^3/g(x, t)^5-3*U(x, t)*(g(x, t)^r)^2*V(x, t)*(diff(g(x, t), x))*r/g(x, t)^5-3*V(x, t)*g(x, t)^r*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))*r^2/g(x, t)^4+15*V(x, t)*g(x, t)^r*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))*r/g(x, t)^4+6*(diff(diff(V(x, t), x), x))*g(x, t)^r*(diff(g(x, t), x))/g(x, t)^3+6*(diff(V(x, t), x))*g(x, t)^r*(diff(diff(g(x, t), x), x))/g(x, t)^3+2*V(x, t)*g(x, t)^r*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)^3+2*V(x, t)*g(x, t)^r*(diff(g(x, t), t))/g(x, t)^3-60*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^3*(diff(diff(g(x, t), x), x))/g(x, t)^4-12*U(x, t)*g(x, t)^r*6^(1/2)*a^(1/2)*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))/g(x, t)^4-18*V(x, t)*g(x, t)^r*(diff(g(x, t), x))*(diff(diff(g(x, t), x), x))/g(x, t)^4-(diff(diff(diff(V(x, t), x), x), x))*g(x, t)^r/g(x, t)^2-(diff(V(x, t), t))*g(x, t)^r/g(x, t)^2-6*(diff(g(x, t), x))^2*(diff(V(x, t), x))*g(x, t)^r/g(x, t)^4-3*U(x, t)*(g(x, t)^r)^2*(diff(V(x, t), x))/g(x, t)^4-(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r*r^3/g(x, t)^5-V(x, t)*g(x, t)^r*(diff(g(x, t), t))*r/g(x, t)^3-3*(diff(diff(V(x, t), x), x))*g(x, t)^r*(diff(g(x, t), x))*r/g(x, t)^3-3*(diff(V(x, t), x))*g(x, t)^r*(diff(diff(g(x, t), x), x))*r/g(x, t)^3-V(x, t)*g(x, t)^r*(diff(diff(diff(g(x, t), x), x), x))*r/g(x, t)^3-3*(diff(g(x, t), x))^2*(diff(V(x, t), x))*g(x, t)^r*r^2/g(x, t)^4-14*(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r*r/g(x, t)^5+6*U(x, t)*(g(x, t)^r)^2*V(x, t)*(diff(g(x, t), x))/g(x, t)^5+15*(diff(g(x, t), x))^2*(diff(V(x, t), x))*g(x, t)^r*r/g(x, t)^4+9*(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r*r^2/g(x, t)^5-4*6^(1/2)*a^(1/2)*(diff(g(x, t), x))*(diff(diff(g(x, t), t), x))/g(x, t)^2+4*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2*(diff(g(x, t), t))/g(x, t)^3+48*6^(1/2)*a^(1/2)*(diff(diff(g(x, t), x), x))^2*(diff(g(x, t), x))/g(x, t)^3+28*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)^3-4*6^(1/2)*a^(1/2)*(diff(g(x, t), x))*(diff(diff(diff(diff(g(x, t), x), x), x), x))/g(x, t)^2-12*6^(1/2)*a^(1/2)*(diff(diff(g(x, t), x), x))*(diff(diff(diff(g(x, t), x), x), x))/g(x, t)^2

Want the dominant (least value).

exps1 := map(findexp, [op(eqr1)]); dom1 := `assuming`([min(select(has, %, r))], [r::posint]); exps2 := map(findexp, [op(eqr2)]); dom2 := `assuming`([min(select(has, %, r))], [r::posint])

[-2, -3, r-4, r-4, r-5, r-4, r-3, r-3, r-3, r-4, r-4, r-5, r-5, r-5, r-4, 2*r-5, r-4, r-5, r-3, r-2, -2, -3, -3, -2, r-2, -4, -4+2*r, 2*r-5, r-3, r-3, r-3, r-3, r-4, r-5, -4+2*r, 2*r-5, 2*r-5]

r-5

[r-5, 2*r-5, r-4, r-4, r-3, r-3, r-3, r-3, -4, r-4, r-4, r-2, r-2, r-4, -4+2*r, r-5, r-3, r-3, r-3, r-3, r-4, r-5, 2*r-5, r-4, r-5, -2, -3, -3, -3, -2, -2]

r-5

So we want all terms with exponent dom; Find when the determinant is zero

eqrr1 := select(proc (q) options operator, arrow; findexp(q) = dom1 end proc, eqr1); eqrr2 := select(proc (q) options operator, arrow; findexp(q) = dom2 end proc, eqr2); M, bb := GenerateMatrix([eqrr1, eqrr2], [U(vars), V(vars)])

-4*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r*r/g(x, t)^5+a*(diff(g(x, t), x))^3*U(x, t)*g(x, t)^r*r^3/g(x, t)^5-9*a*(diff(g(x, t), x))^3*U(x, t)*g(x, t)^r*r^2/g(x, t)^5+2*a*(diff(g(x, t), x))^3*U(x, t)*g(x, t)^r*r/g(x, t)^5+16*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r/g(x, t)^5+72*a*(diff(g(x, t), x))^3*U(x, t)*g(x, t)^r/g(x, t)^5

12*U(x, t)*g(x, t)^r*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^3/g(x, t)^5-(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r*r^3/g(x, t)^5-14*(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r*r/g(x, t)^5+9*(diff(g(x, t), x))^3*V(x, t)*g(x, t)^r*r^2/g(x, t)^5

Matrix(%id = 36893490698808109644), Vector[column](%id = 36893490698808109524)

Find resonant points, but <-1 doesn't count and Painleve doesn't apply; there is not a general solution.

factor(Determinant(M)); [solve(%, r)]; rp := remove(`<`, %, -1); maxrp := max(rp)

-(diff(g(x, t), x))^6*(g(x, t)^r)^2*a*(r-3)*(r-4)*(r-6)*(r-8)*(r+2)*(r+1)/g(x, t)^10

[-2, -1, 3, 4, 6, 8]

[-1, 3, 4, 6, 8]

8

Step 3 -verifying the compatibility condition

equ := u(vars) = eq19ub+eval(add(U[i](vars)*g(vars)^(i+alpha[1]), i = 1 .. maxrp), eqb); eqv := v(vars) = eq19vb+eval(add(V[i](vars)*g(vars)^(i+alpha[2]), i = 1 .. maxrp), eqb)

u(x, t) = -4*(diff(g(x, t), x))^2/g(x, t)^2+U[1](x, t)/g(x, t)+U[2](x, t)+U[3](x, t)*g(x, t)+U[4](x, t)*g(x, t)^2+U[5](x, t)*g(x, t)^3+U[6](x, t)*g(x, t)^4+U[7](x, t)*g(x, t)^5+U[8](x, t)*g(x, t)^6

v(x, t) = 2*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2/g(x, t)^2+V[1](x, t)/g(x, t)+V[2](x, t)+V[3](x, t)*g(x, t)+V[4](x, t)*g(x, t)^2+V[5](x, t)*g(x, t)^3+V[6](x, t)*g(x, t)^4+V[7](x, t)*g(x, t)^5+V[8](x, t)*g(x, t)^6

Substitute back into the pde, and collect wrt g(vars) = G.

coll1 := collect(subs(g[] = G, ToJet(eval(pde1, {equ, eqv}), [g(vars), seq(U[i](vars), i = 1 .. maxrp), seq(V[i](vars), i = 1 .. maxrp)], jetnotation = jetvariableswithbrackets)), G); coll2 := collect(subs(g[] = G, ToJet(eval(pde2, {equ, eqv}), [g(vars), seq(U[i](vars), i = 1 .. maxrp), seq(V[i](vars), i = 1 .. maxrp)], jetnotation = jetvariableswithbrackets)), G); `~`[ldegree]([coll1, coll2], G); mindegree1, mindegree2 := %[]

[-4, -4]

-4, -4

Find the coefficients of the maxrp least-degree terms, since we have maxrp variables to solve for

eqs1 := FromJet([seq(coeff(coll1, G, mindegree1+i), i = 0 .. maxrp-1)], [g(vars), seq(U[i](vars), i = 1 .. maxrp), seq(V[i](vars), i = 1 .. maxrp)]); eqs2 := FromJet([seq(coeff(coll2, G, mindegree2+i), i = 0 .. maxrp-1)], [g(vars), seq(U[i](vars), i = 1 .. maxrp), seq(V[i](vars), i = 1 .. maxrp)])

 

Solving the first equation gives {u[1],v[1]} - Eq 3.24

uv1 := solve({eqs1[1], eqs2[1]}, {U[1](vars), V[1](vars)})

{U[1](x, t) = 4*(diff(diff(g(x, t), x), x)), V[1](x, t) = -2*a^(1/2)*6^(1/2)*(diff(diff(g(x, t), x), x))}

Substitute this in the second equation and solve for U[2] - Eq 3.25

dsubs(uv1, {eqs1[2], eqs2[2]}); uv2 := solve(%, {U[2](vars), V[2](vars)})

{-12*6^(1/2)*a^(1/2)*(diff(diff(g(x, t), x), x))^2*(diff(g(x, t), x))+16*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2*(diff(diff(diff(g(x, t), x), x), x))+12*U[2](x, t)*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^3+4*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^2*(diff(g(x, t), t)), 8*V[2](x, t)*6^(1/2)*a^(1/2)*(diff(g(x, t), x))^3+48*(diff(g(x, t), x))^3*U[2](x, t)*a+32*a*(diff(g(x, t), x))^2*(diff(diff(diff(g(x, t), x), x), x))-24*a*(diff(diff(g(x, t), x), x))^2*(diff(g(x, t), x))-8*(diff(g(x, t), x))^2*(diff(g(x, t), t))}

{U[2](x, t) = -(1/3)*(4*(diff(g(x, t), x))*(diff(diff(diff(g(x, t), x), x), x))+(diff(g(x, t), x))*(diff(g(x, t), t))-3*(diff(diff(g(x, t), x), x))^2)/(diff(g(x, t), x))^2, V[2](x, t) = (1/6)*(4*(diff(diff(diff(g(x, t), x), x), x))*(diff(g(x, t), x))*a+2*(diff(g(x, t), t))*(diff(g(x, t), x))*a-3*(diff(diff(g(x, t), x), x))^2*a+(diff(g(x, t), x))*(diff(g(x, t), t)))*6^(1/2)/((diff(g(x, t), x))^2*a^(1/2))}

This one is a resonance

eqs3 := simplify(dsubs(uv1, uv2, {eqs1[3], eqs2[3]})); M3, bb3 := GenerateMatrix(eqs3, [U[3](vars), V[3](vars)])

Matrix(%id = 36893490698808102772), Vector[column](%id = 36893490698808102652)

The determinant = 0 expected for a resonance. Rank of matrix and augmented matrix are the same - if we solve for U[3] and V[3], we find V[3] is arbitrary and U[3] also has a arbitrary function

Determinant(M3); Rank(M3); Rank(`<|>`(M3, bb3)); LinearSolve(M3, bb3)

0

1

1

Vector[column](%id = 36893490698808773556)

This one is also a resonance

eqs4 := simplify(dsubs(uv1, uv2, U[3](vars) = 0, V[3](vars) = 0, {eqs1[4], eqs2[4]})); M4, bb4 := GenerateMatrix(eqs4, [U[4](vars), V[4](vars)])

Matrix(%id = 36893490698894126244), Vector[column](%id = 36893490698894126004)

Here matrix and augmented matrix have different ranks, no solution.

Determinant(M4); Rank(M4); Rank(`<|>`(M4, bb4)); LinearSolve(M4, bb4)

0

1

2

Error, (in LinearAlgebra:-LinearSolve) inconsistent system

We find a solution for U[5] and V[5]

eqs5 := simplify(dsubs(uv1, uv2, U[3](vars) = 0, V[3](vars) = 0, U[4](vars) = 0, V[4](vars) = 0, {eqs1[5], eqs2[5]})); M5, bb5 := GenerateMatrix(eqs5, [U[5](vars), V[5](vars)])

Matrix(%id = 36893490698796769636), Vector[column](%id = 36893490698796769516)

Determinant(M5)

-252*a*(diff(g(x, t), x))^6

uv5 := {seq(Equate(`<,>`(U[5](vars), V[5](vars)), LinearSolve(M5, bb5)))}

This one is a resonance

eqs6 := simplify(dsubs(uv1, uv2, uv5, U[3](vars) = 0, V[3](vars) = 0, U[4](vars) = 0, V[4](vars) = 0, {eqs1[6], eqs2[6]})); M6, bb6 := GenerateMatrix(eqs6, [U[6](vars), V[6](vars)])

Matrix(%id = 36893490698867434788), Vector[column](%id = 36893490698867434668)

Determinant = 0

Determinant(M6); LinearSolve(M6, bb6)

0

Error, (in LinearAlgebra:-LinearSolve) inconsistent system

Solution for U[7], V[7]

eqs7 := simplify(dsubs(uv1, uv2, uv5, U[3](vars) = 0, V[3](vars) = 0, U[4](vars) = 0, V[4](vars) = 0, U[6](vars) = 0, V[6](vars) = 0, {eqs1[7], eqs2[7]})); M7, bb7 := GenerateMatrix(eqs7, [U[7](vars), V[7](vars)])

Matrix(%id = 36893490698867056756), Vector[column](%id = 36893490698867056636)

Determinant(M7); LinearSolve(M7, bb7)

-864*a*(diff(g(x, t), x))^6

Vector[column](%id = 36893490698894124924)

And this is the last resonance

eqs8 := simplify(dsubs(uv1, uv2, uv5, U[3](vars) = 0, V[3](vars) = 0, U[4](vars) = 0, V[4](vars) = 0, U[6](vars) = 0, V[6](vars) = 0, {eqs1[8], eqs2[8]})); M8, bb8 := GenerateMatrix(eqs8, [U[8](vars), V[8](vars)])

Matrix(%id = 36893490698740702252), Vector[column](%id = 36893490698740702132)

Determinant(M8)

0

I don't understand the bit about needing a=1/2 for compatibility

NULL

Download AllStepscKdV.mw

Yes this factorial in the denominator jumping drives me crazy. It seems to be a side effect of the new 2-D entry system that abbreviates entering x^2 cursor-right + 2 to  x^2+2. It is still present in Maple 2025.1, so there is currently not a solution.

Well, this is probably cheating since I saw the answer, but maybe I would have thought of it anyway.

restart

interface(version)

`Standard Worksheet Interface, Maple 2025.1, Windows 11, June 12 2025 Build ID 1932578`

term := 2*cos(5*arcsin((1/2)*x))

2*cos(5*arcsin((1/2)*x))

term1 := expand(term)

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

Well, combine is usually the opposite of expand, so the first thing I'd try is

combine(term1)

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

I tried a lot of converts without success. Of course not many algebraic things are likely to be expressible as trig functions, so it is just "luck" that term1 came out so simply.

So I'll give Maple a hand, trying to forget that I saw the answer already. Now sqrt(1-x*2) for x = sin/cos(u) gives cos/sin(u), and for the 4's being 2^2 suggests a substitution

tr := x = 2*sin(u); p := simplify(eval(term1, tr))

x = 2*sin(u)

(32*cos(u)^5-40*cos(u)^3+10*cos(u))*csgn(cos(u))

We could play around with assumptions to handle the csgn, but let's be reckless

p2 := simplify(p, symbolic)

2*cos(5*u)

To go back to x we need to inverse transformation

itr := isolate(tr, u)

u = arcsin((1/2)*x)

which gives what we want.

f := eval(p2, itr)

2*cos(5*arcsin((1/2)*x))

If we had used cos instead

tr2 := x = 2*cos(u); q := simplify(eval(term1, tr2), symbolic)

x = 2*cos(u)

2*sin(5*u)

itr2 := isolate(tr2, u); g := eval(q, itr2)

u = arccos((1/2)*x)

2*sin(5*arccos((1/2)*x))

And the plots are on top of each other

plot([f, g], x = -2.5 .. 2.5)

which we can verify exactly

simplify(f-g)

0

NULL

Download test2.mw

Of course it is a bug, but notice that solve gives the same result. It's the classic problem of introducing extraneous solutions by squaring both sides of an equation.

restart;

sys := diff~(sqrt(2*a^2 - 8*a + 10) + sqrt(b^2 - 6*b + 10) + sqrt(2*a^2 - 2*a*b + b^2), {a, b});

{(1/2)*(4*a-8)/(2*a^2-8*a+10)^(1/2)+(1/2)*(4*a-2*b)/(2*a^2-2*a*b+b^2)^(1/2), (1/2)*(2*b-6)/(b^2-6*b+10)^(1/2)+(1/2)*(-2*a+2*b)/(2*a^2-2*a*b+b^2)^(1/2)}

solve(sys);

{a = 5/3, b = 5/2}, {a = a, b = 2*a/(a-1)}

If you solve with infolevel[solve]:=5; you see it solved 5 equations, so plenty of opportunity for extraneous solutions.
So I'm guessing it did something like this:

neweqs := {2*a^2-8*a+10 = s1^2, 2*a^2 - 2*a*b + b^2 = s2^2, b^2 - 6*b + 10 = s3^2};
sys2a:=simplify(eval(sys, neweqs)) assuming s1>0,s2>0,s3>0;
sys2:=numer~(%) union (lhs-rhs)~(neweqs);

{2*a^2-8*a+10 = s1^2, b^2-6*b+10 = s3^2, 2*a^2-2*a*b+b^2 = s2^2}

{(2*(a-2)*s2+(2*a-b)*s1)/(s1*s2), ((b-3)*s2-(a-b)*s3)/(s3*s2)}

{2*a^2-s1^2-8*a+10, b^2-s3^2-6*b+10, 2*a^2-2*a*b+b^2-s2^2, 2*a*s1+2*a*s2-b*s1-4*s2, -a*s3+b*s2+b*s3-3*s2}

The last two answers here are the problematic ones, but actually the first six are special cases of a=a, b=2*a/(a-1). The problem is that s1, s2, s2 are not all positive, so the squaring in neweqs with the assumptions led to the problem

ans:=sort([solve(sys2, {a, b, s1, s2, s3},explicit)]);

[{a = 2, b = 4, s1 = 2^(1/2), s2 = 2*2^(1/2), s3 = -2^(1/2)}, {a = 2, b = 4, s1 = -2^(1/2), s2 = -2*2^(1/2), s3 = 2^(1/2)}, {a = 3, b = 3, s1 = -2, s2 = 3, s3 = -1}, {a = 3, b = 3, s1 = -2, s2 = 3, s3 = 1}, {a = 3, b = 3, s1 = 2, s2 = -3, s3 = -1}, {a = 3, b = 3, s1 = 2, s2 = -3, s3 = 1}, {a = 5/3, b = 5/2, s1 = -(2/3)*5^(1/2), s2 = -(5/6)*5^(1/2), s3 = -(1/2)*5^(1/2)}, {a = 5/3, b = 5/2, s1 = (2/3)*5^(1/2), s2 = (5/6)*5^(1/2), s3 = (1/2)*5^(1/2)}, {a = a, b = 2*a/(a-1), s1 = (2*a^2-8*a+10)^(1/2), s2 = -(2*a^2-8*a+10)^(1/2)*a/(a-1), s3 = (2*a^2-8*a+10)^(1/2)/(a-1)}, {a = a, b = 2*a/(a-1), s1 = -(2*a^2-8*a+10)^(1/2), s2 = (2*a^2-8*a+10)^(1/2)*a/(a-1), s3 = -(2*a^2-8*a+10)^(1/2)/(a-1)}]

All these solutions check out for the expanded system

seq(simplify(eval(sys2,ans[i])), i=1..nops(ans));

{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}

Taking numer wasn't a problem

seq(simplify(eval(sys2a,ans[i])), i=1..nops(ans));

{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}

OK in neweqs

seq(simplify(eval(neweqs,ans[i])), i=1..nops(ans));

{2 = 2, 8 = 8}, {2 = 2, 8 = 8}, {1 = 1, 4 = 4, 9 = 9}, {1 = 1, 4 = 4, 9 = 9}, {1 = 1, 4 = 4, 9 = 9}, {1 = 1, 4 = 4, 9 = 9}, {5/4 = 5/4, 20/9 = 20/9, 125/36 = 125/36}, {5/4 = 5/4, 20/9 = 20/9, 125/36 = 125/36}, {(2*a^2-8*a+10)/(a-1)^2 = (2*a^2-8*a+10)/(a-1)^2, 2*a^2*(a^2-4*a+5)/(a-1)^2 = 2*a^2*(a^2-4*a+5)/(a-1)^2, 2*a^2-8*a+10 = 2*a^2-8*a+10}, {(2*a^2-8*a+10)/(a-1)^2 = (2*a^2-8*a+10)/(a-1)^2, 2*a^2*(a^2-4*a+5)/(a-1)^2 = 2*a^2*(a^2-4*a+5)/(a-1)^2, 2*a^2-8*a+10 = 2*a^2-8*a+10}

But not in sys

seq(simplify(eval(sys,ans[i])), i=1..nops(ans));

{0, 2^(1/2)}, {0, 2^(1/2)}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0}, {0}, {(a-2)*(2/(2*a^2-8*a+10)^(1/2)+a*2^(1/2)/((a^2*(a^2-4*a+5)/(a-1)^2)^(1/2)*(a-1))), -(1/2)*2^(1/2)*(a-3)*(1/((a^2-4*a+5)/(a-1)^2)^(1/2)+a/(a^2*(a^2-4*a+5)/(a-1)^2)^(1/2))/(a-1)}, {(a-2)*(2/(2*a^2-8*a+10)^(1/2)+a*2^(1/2)/((a^2*(a^2-4*a+5)/(a-1)^2)^(1/2)*(a-1))), -(1/2)*2^(1/2)*(a-3)*(1/((a^2-4*a+5)/(a-1)^2)^(1/2)+a/(a^2*(a^2-4*a+5)/(a-1)^2)^(1/2))/(a-1)}

 

NULL

Download realsolve.mw

[Edit - modified so step 1 works as described in the literature - see more examples with refs below.]

restart

with(PDEtools)

undeclare(prime, quiet)

vars := x, t; declare(u(vars), quiet); declare(Phi(vars), quiet); declare(phi(vars), quiet)

Burgers eqn  - see https://doi.org/10.1063/1.525721

pde1 := diff(u(x, t), t)+u(x, t)*(diff(u(x, t), x))-sigma*(diff(u(x, t), x, x))

diff(u(x, t), t)+u(x, t)*(diff(u(x, t), x))-sigma*(diff(diff(u(x, t), x), x))

Routine to find symbolic exponent of phi

findexp := proc (T) options operator, arrow; simplify(phi(vars)*Physics:-diff(T, phi(vars))/T) end proc

Step 1

equ1 := u(vars) = chi*phi(vars)^a

u(x, t) = chi*phi(x, t)^a

eqphi := expand(eval(pde1, equ1))

chi*phi(x, t)^a*a*(diff(phi(x, t), t))/phi(x, t)+chi^2*(phi(x, t)^a)^2*a*(diff(phi(x, t), x))/phi(x, t)-sigma*chi*phi(x, t)^a*a^2*(diff(phi(x, t), x))^2/phi(x, t)^2-sigma*chi*phi(x, t)^a*a*(diff(diff(phi(x, t), x), x))/phi(x, t)+sigma*chi*phi(x, t)^a*a*(diff(phi(x, t), x))^2/phi(x, t)^2

Find all the distinct powers of phi

exps := [(`minus`(map(findexp, {op(eqphi+forceplus)}), {0}))[]]

[a-2, a-1, 2*a-1]

We are supposed to compare all pairs of lowest exponents. So first find the lowest line for each slope.

convert(ListTools:-Classify(diff, exps, a), list); expmins := `~`[min](%)

[{a-2, a-1}, {2*a-1}]

[a-2, 2*a-1]

Now compare all pairs of these to find the intersection with least a

eqa := a = min(seq(seq(solve(expmins[i] = expmins[j], a), i = 1 .. j-1), j = 1 .. nops(expmins)))

a = -1

eq6 := u(vars) = eval(chi*phi(vars)^a, eqa)

u(x, t) = chi/phi(x, t)

The following has all the terms, not just those from the highest derivative and higher nonlinearity

eq7 := expand(eval(pde1, eq6))

-chi*(diff(phi(x, t), t))/phi(x, t)^2-chi^2*(diff(phi(x, t), x))/phi(x, t)^3-2*sigma*chi*(diff(phi(x, t), x))^2/phi(x, t)^3+sigma*chi*(diff(diff(phi(x, t), x), x))/phi(x, t)^2

We want only the terms with phi^(mindeg), but we cannot collect wrt phi, so convert it to a simple name before collecting

eq7c := subs(phi[] = F, ToJet(eq7, phi(vars), jetnotation = jetvariableswithbrackets))

-chi*phi[t]/F^2-chi^2*phi[x]/F^3-2*sigma*chi*phi[x]^2/F^3+sigma*chi*phi[x, x]/F^2

mindeg := ldegree(eq7c, F)

-3

S := FromJet(coeff(collect(eq7c, F), F, mindeg), phi(vars))

-2*sigma*chi*(diff(phi(x, t), x))^2-chi^2*(diff(phi(x, t), x))

eqchi := chi = solve(S, chi)[2]

chi = -2*(diff(phi(x, t), x))*sigma

Following is u[0]/phi^a, which we use in step 2

u0phia := rhs(eval(eq6, eqchi))

-2*(diff(phi(x, t), x))*sigma/phi(x, t)

So we found (chi) and (a) which was our target for first step

Step 2 - finding resonance points. use Phi as short for phi_j

eq11 := u(vars) = u0phia+eval(Phi(vars)*phi(vars)^(j+a), eqa)

u(x, t) = -2*(diff(phi(x, t), x))*sigma/phi(x, t)+Phi(x, t)*phi(x, t)^(j-1)

We substitute into the pde, and seek "the coefficients of the dominant terms",

eq11b := expand(eval(pde1, eq11))

Following routine finds the exponent of phi in a term T

findexp := proc (T) options operator, arrow; simplify(phi(vars)*Physics:-diff(T, phi(vars))/T) end proc

proc (T) options operator, arrow; simplify(phi(vars)*Physics:-diff(T, phi(vars))/T) end proc

Want the dominant (least value).

exps := map(findexp, [op(eq11b)]); dom := `assuming`([min(select(has, %, j))], [j::posint])

[-1, j-1, -1, j-2, j-3, j-2, j-3, j-2, -2, 2*j-2, -3+2*j, j-1, -2, j-2, j-3, j-2, -3+2*j]

j-3

So we want all terms with exponent dom; Solve the equation with these terms to find the resonant points.

eq12 := select(proc (q) options operator, arrow; findexp(q) = dom end proc, eq11b); rp := [solve(eq12, j)]; maxrp := max(rp)

(diff(phi(x, t), x))^2*sigma*Phi(x, t)*phi(x, t)^j*j/phi(x, t)^3-sigma*Phi(x, t)*phi(x, t)^j*(diff(phi(x, t), x))^2*j^2/phi(x, t)^3+2*(diff(phi(x, t), x))^2*sigma*Phi(x, t)*phi(x, t)^j/phi(x, t)^3

[2, -1]

2

Step 3 -verifying the compatibility condition

eq14 := u(vars) = u0phia+eval(add(Phi[j](vars)*phi(vars)^(j+a), j = 1 .. maxrp), eqa)

u(x, t) = -2*(diff(phi(x, t), x))*sigma/phi(x, t)+Phi[1](x, t)+Phi[2](x, t)*phi(x, t)

Substitute back into the pde, and collect wrt phi(vars) = F.

depvars := [phi(vars), seq(Phi[i](vars), i = 1 .. maxrp)]; coll := collect(subs(phi[] = F, ToJet(eval(pde1, eq14), depvars, jetnotation = jetvariableswithbrackets)), F); mindegree := ldegree(coll, F)

Phi[2][]*Phi[2][x]*F^2+(Phi[2][t]+Phi[1][]*Phi[2][x]+Phi[2][]*(phi[x]*Phi[2][]+Phi[1][x])-sigma*Phi[2][x, x])*F+Phi[1][t]+Phi[2][]*phi[t]-2*phi[x]*sigma*Phi[2][x]+Phi[1][]*(phi[x]*Phi[2][]+Phi[1][x])-2*Phi[2][]*phi[x, x]*sigma-sigma*(2*phi[x]*Phi[2][x]+phi[x, x]*Phi[2][]+Phi[1][x, x])+(-2*phi[x, t]*sigma-2*phi[x]*sigma*(phi[x]*Phi[2][]+Phi[1][x])-2*Phi[1][]*phi[x, x]*sigma+2*Phi[2][]*phi[x]^2*sigma+2*sigma^2*phi[x, x, x])/F+(-2*sigma^2*phi[x]*phi[x, x]+2*sigma*phi[x]^2*Phi[1][]+2*sigma*phi[t]*phi[x])/F^2

-2

Find the coefficients of the maxrp least-degree terms, since we have maxrp variables to solve for

eqs := FromJet([seq(coeff(coll, F, mindegree+i), i = 0 .. maxrp-1)], depvars)

[-2*(diff(phi(x, t), x))*sigma^2*(diff(diff(phi(x, t), x), x))+2*Phi[1](x, t)*(diff(phi(x, t), x))^2*sigma+2*(diff(phi(x, t), x))*sigma*(diff(phi(x, t), t)), -2*(diff(diff(phi(x, t), t), x))*sigma-2*(diff(phi(x, t), x))*sigma*(Phi[2](x, t)*(diff(phi(x, t), x))+diff(Phi[1](x, t), x))-2*Phi[1](x, t)*(diff(diff(phi(x, t), x), x))*sigma+2*Phi[2](x, t)*(diff(phi(x, t), x))^2*sigma+2*sigma^2*(diff(diff(diff(phi(x, t), x), x), x))]

For the Burger's equation, solving the first equation gives u[1] - Eq. 3.7

u1 := Phi[1](vars) = solve(eqs[1], Phi[1](vars))

Phi[1](x, t) = ((diff(diff(phi(x, t), x), x))*sigma-(diff(phi(x, t), t)))/(diff(phi(x, t), x))

If we substitute this in the second equation, it simplifies to zero, which is why we cannot just solve the system.
This is because j=2 is a resonance point.
We have found Eq. 3.8; the factor in the first line below is the derivative wrt x of the eqn for u1.

simplify(eqs[2]); simplify(dsubs(u1, eqs[2]))

-2*sigma*((diff(phi(x, t), x))*(diff(Phi[1](x, t), x))+Phi[1](x, t)*(diff(diff(phi(x, t), x), x))-sigma*(diff(diff(diff(phi(x, t), x), x), x))+diff(diff(phi(x, t), t), x))

0

NULL

Download AllstepsBurgerNew.mw

Example 2: OP's Hirota Bilinear eqn

AllstepsBurgerNew.mw

Example 3: KdV equation

AllStepsKdVnew2.mw

 

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