Rouben Rostamian

MaplePrimes Activity


These are answers submitted by Rouben Rostamian

I can't tell exactly what problem you are attempting to solve but I can sort of guess by looking through your worksheet.  It is not clear to me why you discretize time. It would be more natural to look at time as a continuous variable.  With that in mind, the calculations in the following worksheet may be relevant to your objectives.

A homogenous disk of radius R and mass M rolls without slipping
on a horizontal line. One end of a massless rod of length a is attached
to the disk's center.  A point of mass m is attached to the other end
of the rod.  We derive the equations of motion and animate.

restart;

with(plots):
with(plottools):

The position vector to the center of the disk (radius=R):

r[1] := x -> < x, R >;

proc (x) options operator, arrow; `<,>`(x, R) end proc

The position vector to the pendulum's bob.

Here a is the length of the rod and phi is the angle

of the rod with respect to the vertical.

r[1](x) + a*<sin(phi), -cos(phi)>;
r[2] := unapply(%, [x,phi]):

Vector(2, {(1) = x+a*sin(phi), (2) = R-a*cos(phi)})

The velocities

v[1] := diff(r[1](x(t)), t);

Vector(2, {(1) = diff(x(t), t), (2) = 0})

v[2] := diff(r[2](x(t),phi(t)), t);

Vector(2, {(1) = diff(x(t), t)+a*(diff(phi(t), t))*cos(phi(t)), (2) = a*(diff(phi(t), t))*sin(phi(t))})

Assuming that the disk does not slip against the x axis leads to this constraint:

de1 := diff(x(t), t) = -(diff(phi(t), t))*R;

diff(x(t), t) = -(diff(phi(t), t))*R

Now we calculate the system's kinetic energy.
The mass of the disk is M. The mass of the bob is m.
The moment of inertia of a uniform circular disk of
mass M is J = (1/2)*MR^2.

  1/2*M*(v[1]^+ . v[1])
+ 1/2*J*diff(phi(t),t)^2
+ 1/2*m*(v[2]^+ . v[2]):
eval(%, {J=1/2*M*R^2, de1}):
T := simplify(%);

(1/4)*(-4*cos(phi(t))*R*a*m+(3*M+2*m)*R^2+2*a^2*m)*(diff(phi(t), t))^2

and the potential energy

V := m*g*r[2](x(t),phi(t))[2];

m*g*(R-a*cos(phi(t)))

L := T - V;  # the Lagrangian

(1/4)*(-4*cos(phi(t))*R*a*m+(3*M+2*m)*R^2+2*a^2*m)*(diff(phi(t), t))^2-m*g*(R-a*cos(phi(t)))

Apply the Euler-Lagrange formula to obtain the differential equation of motion

VariationalCalculus:-EulerLagrange(L, t, phi(t)):
remove(type, %, equation):
de2 := solve(%, diff(phi(t),t,t))[];

diff(diff(phi(t), t), t) = -2*sin(phi(t))*a*m*((diff(phi(t), t))^2*R+g)/(2*a^2*m-4*cos(phi(t))*R*a*m+3*M*R^2+2*R^2*m)

params := M=2, m=1, g=1, R=1, a=3:

ic := x(0)=0, phi(0)=0, D(phi)(0)=1;

x(0) = 0, phi(0) = 0, (D(phi))(0) = 1

Solve the system of two differential equations de1, de2 for the unknowns x(t), phi(t).

dsol := dsolve(eval({de1,de2,ic}, {params}), numeric, output=operator);

[t = proc (t) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _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](t) else _xout := evalf(t) end if; _dat := Array(1..4, {(1) = proc (_xin) local _xout, _dtbl, _dat, _vmap, _x0, _y0, _val, _dig, _n, _ne, _nd, _nv, _pars, _ini, _par, _i, _j, _k, _src; option `Copyright (c) 2002 by Waterloo Maple Inc. All rights reserved.`; table( [( "complex" ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 26, [( 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..63, {(1) = 3, (2) = 3, (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}, datatype = integer[8])), ( 5 ) = (Array(1..28, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = 0.5047658755841546e-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..3, {(1) = .0, (2) = 1.0, (3) = .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..3, {(1) = .1, (2) = .1, (3) = .1}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 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}, datatype = float[8], order = C_order), Array(1..3, {(1) = 0, (2) = 0, (3) = 0}, datatype = integer[8]), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..6, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0}, datatype = float[8], order = C_order)]), ( 8 ) = ([Array(1..3, {(1) = .0, (2) = 1.0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = 1.0, (2) = -.0, (3) = -1.0}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = phi(t), Y[2] = diff(phi(t),t), Y[3] = x(t)]`; YP[2] := -6*sin(Y[1])*(Y[2]^2+1)/(26-12*cos(Y[1])); YP[3] := -Y[2]; YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rkf45"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = phi(t), Y[2] = diff(phi(t),t), Y[3] = x(t)]`; YP[2] := -6*sin(Y[1])*(Y[2]^2+1)/(26-12*cos(Y[1])); YP[3] := -Y[2]; YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 26 ) = (Array(1..0, {})), ( 25 ) = (Array(1..0, {})), ( 24 ) = (0)  ] ))  ] ); _y0 := Array(0..3, {(1) = 0., (2) = 0., (3) = 1.}); _vmap := array( 1 .. 3, [( 1 ) = (1), ( 2 ) = (2), ( 3 ) = (3)  ] ); _x0 := _dtbl[1][5][5]; _n := _dtbl[1][4][1]; _ne := _dtbl[1][4][3]; _nd := _dtbl[1][4][4]; _nv := _dtbl[1][4][16]; if not type(_xout, 'numeric') then if member(_xout, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = "left" then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = "right" then if type(_dtbl[3], 'table') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _xout = "method" then return _dtbl[1][15] elif _xout = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _xout = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = "enginedata" then return eval(_dtbl[1]) elif _xout = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = "initial" then return procname(_y0[0]) elif _xout = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "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 _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = "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 _xout = "map" then return copy(_vmap) 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, _y0) end if; if _ini <> [] then `dsolve/numeric/process_initial`(_n-_ne, _ini, _y0, _pars, _vmap) end if; `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, 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; if _xout = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)], [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] end if elif _xin = "eventstop" then if _nv = 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 _xin = "eventstatus" then if _nv = 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][_nv+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _xin = "eventclear" then if _nv = 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 _nv < _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 _nv 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][_nv+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(_xin, `=`) and member(lhs(_xin), {"eventdisable", "eventenable"}) then if _nv = 0 then error "this solution has no events" end if; if type(rhs(_xin), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _k := {}; for _j to _nv do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_xin) = "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 _nv+1 do if _k <= _nv 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 _nv+1 do if _k <= _nv 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(_xin, `=`) and lhs(_xin) = "eventfired" then if not type(rhs(_xin), 'list') then error "'eventfired' must be specified as a list" end if; if _nv = 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(_xin) 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][_nv+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nv)}; 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(_xin, `=`) and lhs(_xin) = "direction" then if not member(rhs(_xin), {-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(_xin), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv 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 _xin = "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][_nv+1, 12]) end if else return "procname" end if end if; if _xout = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _n-_ne)] end if; _i := `if`(_x0 <= _xout, 3, 2); if _xin = "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 .. _n-_ne-_nd), seq(_dat[8][1][_vmap[_i]], _i = _n-_ne-_nd+1 .. _n-_ne)] 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 < _nv then for _j to _nv+1 do if _j <= _nv 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 _xin <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _n, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, 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, _xout) 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][_nv+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] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _xout 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 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+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'; _xout := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _xout < _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 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+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'; _xout := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _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, _xout, _src); _dat[4][25] := _i; _dat[4][26] := _dig; [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _xout, _src); [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] end if end proc, (2) = Array(1..4, {(1) = 18446884266891554150, (2) = 18446884266891554326, (3) = 18446884266891554502, (4) = 18446884266891554678}), (3) = [t, phi(t), diff(phi(t), t), x(t)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(t, ["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(t, '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(t, ["last", 'last', "initial", 'initial', NULL]) then _res := _solnproc(convert(t, 'string')); if type(_res, 'list') then return _res[1] else return NULL end if elif member(t, ["parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(t, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[1], seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(t), 'string') = rhs(t); if lhs(_xout) = "initial" then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc("initial" = ["single", 1, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error "initial and/or parameter values must be specified in a list" elif lhs(_xout) = "initial_and_parameters" and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = ["single", 1, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = "initial" then return _res[1] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[1], 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', NULL]) then return _solnproc(convert(lhs(t), 'string') = rhs(t)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _dat[3] end if; if procname <> unknown then return ('procname')(t) else _ndsol := 1; _ndsol := `tools/gensym`("t"); eval(FromInert(_Inert_FUNCTION(_Inert_NAME("assign"), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][1])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(t)))) end if end if; try _res := _solnproc(_xout); _res[1] catch: error  end try end proc, phi = proc (t) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _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](t) else _xout := evalf(t) end if; _dat := Array(1..4, {(1) = proc (_xin) local _xout, _dtbl, _dat, _vmap, _x0, _y0, _val, _dig, _n, _ne, _nd, _nv, _pars, _ini, _par, _i, _j, _k, _src; option `Copyright (c) 2002 by Waterloo Maple Inc. All rights reserved.`; table( [( "complex" ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 26, [( 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..63, {(1) = 3, (2) = 3, (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}, datatype = integer[8])), ( 5 ) = (Array(1..28, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = 0.5047658755841546e-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..3, {(1) = .0, (2) = 1.0, (3) = .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..3, {(1) = .1, (2) = .1, (3) = .1}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 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}, datatype = float[8], order = C_order), Array(1..3, {(1) = 0, (2) = 0, (3) = 0}, datatype = integer[8]), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..6, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0}, datatype = float[8], order = C_order)]), ( 8 ) = ([Array(1..3, {(1) = .0, (2) = 1.0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = 1.0, (2) = -.0, (3) = -1.0}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = phi(t), Y[2] = diff(phi(t),t), Y[3] = x(t)]`; YP[2] := -6*sin(Y[1])*(Y[2]^2+1)/(26-12*cos(Y[1])); YP[3] := -Y[2]; YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rkf45"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = phi(t), Y[2] = diff(phi(t),t), Y[3] = x(t)]`; YP[2] := -6*sin(Y[1])*(Y[2]^2+1)/(26-12*cos(Y[1])); YP[3] := -Y[2]; YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 26 ) = (Array(1..0, {})), ( 25 ) = (Array(1..0, {})), ( 24 ) = (0)  ] ))  ] ); _y0 := Array(0..3, {(1) = 0., (2) = 0., (3) = 1.}); _vmap := array( 1 .. 3, [( 1 ) = (1), ( 2 ) = (2), ( 3 ) = (3)  ] ); _x0 := _dtbl[1][5][5]; _n := _dtbl[1][4][1]; _ne := _dtbl[1][4][3]; _nd := _dtbl[1][4][4]; _nv := _dtbl[1][4][16]; if not type(_xout, 'numeric') then if member(_xout, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = "left" then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = "right" then if type(_dtbl[3], 'table') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _xout = "method" then return _dtbl[1][15] elif _xout = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _xout = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = "enginedata" then return eval(_dtbl[1]) elif _xout = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = "initial" then return procname(_y0[0]) elif _xout = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "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 _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = "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 _xout = "map" then return copy(_vmap) 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, _y0) end if; if _ini <> [] then `dsolve/numeric/process_initial`(_n-_ne, _ini, _y0, _pars, _vmap) end if; `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, 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; if _xout = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)], [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] end if elif _xin = "eventstop" then if _nv = 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 _xin = "eventstatus" then if _nv = 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][_nv+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _xin = "eventclear" then if _nv = 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 _nv < _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 _nv 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][_nv+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(_xin, `=`) and member(lhs(_xin), {"eventdisable", "eventenable"}) then if _nv = 0 then error "this solution has no events" end if; if type(rhs(_xin), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _k := {}; for _j to _nv do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_xin) = "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 _nv+1 do if _k <= _nv 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 _nv+1 do if _k <= _nv 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(_xin, `=`) and lhs(_xin) = "eventfired" then if not type(rhs(_xin), 'list') then error "'eventfired' must be specified as a list" end if; if _nv = 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(_xin) 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][_nv+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nv)}; 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(_xin, `=`) and lhs(_xin) = "direction" then if not member(rhs(_xin), {-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(_xin), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv 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 _xin = "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][_nv+1, 12]) end if else return "procname" end if end if; if _xout = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _n-_ne)] end if; _i := `if`(_x0 <= _xout, 3, 2); if _xin = "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 .. _n-_ne-_nd), seq(_dat[8][1][_vmap[_i]], _i = _n-_ne-_nd+1 .. _n-_ne)] 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 < _nv then for _j to _nv+1 do if _j <= _nv 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 _xin <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _n, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, 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, _xout) 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][_nv+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] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _xout 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 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+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'; _xout := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _xout < _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 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+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'; _xout := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _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, _xout, _src); _dat[4][25] := _i; _dat[4][26] := _dig; [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _xout, _src); [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] end if end proc, (2) = Array(1..4, {(1) = 18446884266891554150, (2) = 18446884266891554326, (3) = 18446884266891554502, (4) = 18446884266891554678}), (3) = [t, phi(t), diff(phi(t), t), x(t)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(t, ["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(t, '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(t, ["last", 'last', "initial", 'initial', NULL]) then _res := _solnproc(convert(t, 'string')); if type(_res, 'list') then return _res[2] else return NULL end if elif member(t, ["parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(t, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[2], seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(t), 'string') = rhs(t); if lhs(_xout) = "initial" then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc("initial" = ["single", 2, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error "initial and/or parameter values must be specified in a list" elif lhs(_xout) = "initial_and_parameters" and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = ["single", 2, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = "initial" then return _res[2] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[2], 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', NULL]) then return _solnproc(convert(lhs(t), 'string') = rhs(t)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _dat[3] end if; if procname <> unknown then return ('procname')(t) else _ndsol := 1; _ndsol := `tools/gensym`("phi"); eval(FromInert(_Inert_FUNCTION(_Inert_NAME("assign"), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][2])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(t)))) end if end if; try _res := _solnproc(_xout); _res[2] catch: error  end try end proc, D(phi) = proc (t) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _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](t) else _xout := evalf(t) end if; _dat := Array(1..4, {(1) = proc (_xin) local _xout, _dtbl, _dat, _vmap, _x0, _y0, _val, _dig, _n, _ne, _nd, _nv, _pars, _ini, _par, _i, _j, _k, _src; option `Copyright (c) 2002 by Waterloo Maple Inc. All rights reserved.`; table( [( "complex" ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 26, [( 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..63, {(1) = 3, (2) = 3, (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}, datatype = integer[8])), ( 5 ) = (Array(1..28, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = 0.5047658755841546e-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..3, {(1) = .0, (2) = 1.0, (3) = .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..3, {(1) = .1, (2) = .1, (3) = .1}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 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}, datatype = float[8], order = C_order), Array(1..3, {(1) = 0, (2) = 0, (3) = 0}, datatype = integer[8]), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..6, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0}, datatype = float[8], order = C_order)]), ( 8 ) = ([Array(1..3, {(1) = .0, (2) = 1.0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = 1.0, (2) = -.0, (3) = -1.0}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = phi(t), Y[2] = diff(phi(t),t), Y[3] = x(t)]`; YP[2] := -6*sin(Y[1])*(Y[2]^2+1)/(26-12*cos(Y[1])); YP[3] := -Y[2]; YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rkf45"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = phi(t), Y[2] = diff(phi(t),t), Y[3] = x(t)]`; YP[2] := -6*sin(Y[1])*(Y[2]^2+1)/(26-12*cos(Y[1])); YP[3] := -Y[2]; YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 26 ) = (Array(1..0, {})), ( 25 ) = (Array(1..0, {})), ( 24 ) = (0)  ] ))  ] ); _y0 := Array(0..3, {(1) = 0., (2) = 0., (3) = 1.}); _vmap := array( 1 .. 3, [( 1 ) = (1), ( 2 ) = (2), ( 3 ) = (3)  ] ); _x0 := _dtbl[1][5][5]; _n := _dtbl[1][4][1]; _ne := _dtbl[1][4][3]; _nd := _dtbl[1][4][4]; _nv := _dtbl[1][4][16]; if not type(_xout, 'numeric') then if member(_xout, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = "left" then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = "right" then if type(_dtbl[3], 'table') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _xout = "method" then return _dtbl[1][15] elif _xout = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _xout = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = "enginedata" then return eval(_dtbl[1]) elif _xout = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = "initial" then return procname(_y0[0]) elif _xout = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "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 _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = "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 _xout = "map" then return copy(_vmap) 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, _y0) end if; if _ini <> [] then `dsolve/numeric/process_initial`(_n-_ne, _ini, _y0, _pars, _vmap) end if; `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, 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; if _xout = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)], [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] end if elif _xin = "eventstop" then if _nv = 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 _xin = "eventstatus" then if _nv = 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][_nv+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _xin = "eventclear" then if _nv = 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 _nv < _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 _nv 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][_nv+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(_xin, `=`) and member(lhs(_xin), {"eventdisable", "eventenable"}) then if _nv = 0 then error "this solution has no events" end if; if type(rhs(_xin), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _k := {}; for _j to _nv do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_xin) = "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 _nv+1 do if _k <= _nv 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 _nv+1 do if _k <= _nv 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(_xin, `=`) and lhs(_xin) = "eventfired" then if not type(rhs(_xin), 'list') then error "'eventfired' must be specified as a list" end if; if _nv = 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(_xin) 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][_nv+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nv)}; 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(_xin, `=`) and lhs(_xin) = "direction" then if not member(rhs(_xin), {-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(_xin), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv 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 _xin = "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][_nv+1, 12]) end if else return "procname" end if end if; if _xout = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _n-_ne)] end if; _i := `if`(_x0 <= _xout, 3, 2); if _xin = "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 .. _n-_ne-_nd), seq(_dat[8][1][_vmap[_i]], _i = _n-_ne-_nd+1 .. _n-_ne)] 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 < _nv then for _j to _nv+1 do if _j <= _nv 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 _xin <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _n, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, 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, _xout) 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][_nv+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] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _xout 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 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+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'; _xout := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _xout < _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 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+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'; _xout := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _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, _xout, _src); _dat[4][25] := _i; _dat[4][26] := _dig; [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _xout, _src); [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] end if end proc, (2) = Array(1..4, {(1) = 18446884266891554150, (2) = 18446884266891554326, (3) = 18446884266891554502, (4) = 18446884266891554678}), (3) = [t, phi(t), diff(phi(t), t), x(t)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(t, ["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(t, '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(t, ["last", 'last', "initial", 'initial', NULL]) then _res := _solnproc(convert(t, 'string')); if type(_res, 'list') then return _res[3] else return NULL end if elif member(t, ["parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(t, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[3], seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(t), 'string') = rhs(t); if lhs(_xout) = "initial" then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc("initial" = ["single", 3, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error "initial and/or parameter values must be specified in a list" elif lhs(_xout) = "initial_and_parameters" and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = ["single", 3, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = "initial" then return _res[3] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[3], 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', NULL]) then return _solnproc(convert(lhs(t), 'string') = rhs(t)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _dat[3] end if; if procname <> unknown then return ('procname')(t) else _ndsol := 1; _ndsol := `tools/gensym`("D(phi)"); eval(FromInert(_Inert_FUNCTION(_Inert_NAME("assign"), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][3])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(t)))) end if end if; try _res := _solnproc(_xout); _res[3] catch: error  end try end proc, x = proc (t) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _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](t) else _xout := evalf(t) end if; _dat := Array(1..4, {(1) = proc (_xin) local _xout, _dtbl, _dat, _vmap, _x0, _y0, _val, _dig, _n, _ne, _nd, _nv, _pars, _ini, _par, _i, _j, _k, _src; option `Copyright (c) 2002 by Waterloo Maple Inc. All rights reserved.`; table( [( "complex" ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 26, [( 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..63, {(1) = 3, (2) = 3, (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}, datatype = integer[8])), ( 5 ) = (Array(1..28, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = 0.5047658755841546e-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..3, {(1) = .0, (2) = 1.0, (3) = .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..3, {(1) = .1, (2) = .1, (3) = .1}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, 1..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0}, datatype = float[8], order = C_order), Array(1..3, 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}, datatype = float[8], order = C_order), Array(1..3, {(1) = 0, (2) = 0, (3) = 0}, datatype = integer[8]), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..6, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0}, datatype = float[8], order = C_order)]), ( 8 ) = ([Array(1..3, {(1) = .0, (2) = 1.0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = .0, (2) = .0, (3) = .0}, datatype = float[8], order = C_order), Array(1..3, {(1) = 1.0, (2) = -.0, (3) = -1.0}, datatype = float[8], order = C_order), 0, 0]), ( 11 ) = (Array(1..6, 0..3, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (3, 3) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (4, 3) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (5, 3) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0, (6, 3) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = phi(t), Y[2] = diff(phi(t),t), Y[3] = x(t)]`; YP[2] := -6*sin(Y[1])*(Y[2]^2+1)/(26-12*cos(Y[1])); YP[3] := -Y[2]; YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 13 ) = (), ( 12 ) = (), ( 15 ) = ("rkf45"), ( 14 ) = ([0, 0]), ( 18 ) = ([]), ( 19 ) = (0), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = phi(t), Y[2] = diff(phi(t),t), Y[3] = x(t)]`; YP[2] := -6*sin(Y[1])*(Y[2]^2+1)/(26-12*cos(Y[1])); YP[3] := -Y[2]; YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0, 0, 0]), ( 22 ) = (0), ( 23 ) = (0), ( 20 ) = ([]), ( 21 ) = (0), ( 26 ) = (Array(1..0, {})), ( 25 ) = (Array(1..0, {})), ( 24 ) = (0)  ] ))  ] ); _y0 := Array(0..3, {(1) = 0., (2) = 0., (3) = 1.}); _vmap := array( 1 .. 3, [( 1 ) = (1), ( 2 ) = (2), ( 3 ) = (3)  ] ); _x0 := _dtbl[1][5][5]; _n := _dtbl[1][4][1]; _ne := _dtbl[1][4][3]; _nd := _dtbl[1][4][4]; _nv := _dtbl[1][4][16]; if not type(_xout, 'numeric') then if member(_xout, ["start", "left", "right"]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = "left" then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = "right" then if type(_dtbl[3], 'table') then return _dtbl[3][5][1] end if end if end if; return _dtbl[1][5][5] elif _xout = "method" then return _dtbl[1][15] elif _xout = "storage" then return evalb(_dtbl[1][4][10] = 1) elif _xout = "leftdata" then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = "rightdata" then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = "enginedata" then return eval(_dtbl[1]) elif _xout = "enginereset" then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = "initial" then return procname(_y0[0]) elif _xout = "laxtol" then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = "numfun" then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "initial_and_parameters" then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = "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 _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = "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 _xout = "map" then return copy(_vmap) 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, _y0) end if; if _ini <> [] then `dsolve/numeric/process_initial`(_n-_ne, _ini, _y0, _pars, _vmap) end if; `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, 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; if _xout = "initial" then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = "parameters" then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] else return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)], [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] end if elif _xin = "eventstop" then if _nv = 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 _xin = "eventstatus" then if _nv = 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][_nv+1, 1]))})]; return ':-enabled' = _i[1], ':-disabled' = _i[2] elif _xin = "eventclear" then if _nv = 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 _nv < _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 _nv 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][_nv+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(_xin, `=`) and member(lhs(_xin), {"eventdisable", "eventenable"}) then if _nv = 0 then error "this solution has no events" end if; if type(rhs(_xin), {('list')('posint'), ('set')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv < a end proc, _i) <> {} then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _k := {}; for _j to _nv do if member(round(_dtbl[1][3][1][_j, 1]), _i) then _k := `union`(_k, {_j}) end if end do; _i := _k; if lhs(_xin) = "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 _nv+1 do if _k <= _nv 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 _nv+1 do if _k <= _nv 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(_xin, `=`) and lhs(_xin) = "eventfired" then if not type(rhs(_xin), 'list') then error "'eventfired' must be specified as a list" end if; if _nv = 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(_xin) 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][_nv+1, 1]) < _src then error "event identifiers must be integers in the range 1..%1", round(_dtbl[1][3][1][_nv+1, 1]) end if; _src := {seq(`if`(_dtbl[1][3][1][_j, 1]-_src = 0., _j, NULL), _j = 1 .. _nv)}; 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(_xin, `=`) and lhs(_xin) = "direction" then if not member(rhs(_xin), {-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(_xin), {1, ':-right'}), 3, 2); _dtbl[4] := _i; _dtbl[_i] := `dsolve/numeric/SC/IVPdcopy`(_dtbl[1], `if`(assigned(_dtbl[_i]), _dtbl[_i], NULL)); if 0 < _nv then for _j to _nv+1 do if _j <= _nv 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 _xin = "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][_nv+1, 12]) end if else return "procname" end if end if; if _xout = _x0 then return [_x0, seq(evalf(_dtbl[1][6][_vmap[_i]]), _i = 1 .. _n-_ne)] end if; _i := `if`(_x0 <= _xout, 3, 2); if _xin = "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 .. _n-_ne-_nd), seq(_dat[8][1][_vmap[_i]], _i = _n-_ne-_nd+1 .. _n-_ne)] 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 < _nv then for _j to _nv+1 do if _j <= _nv 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 _xin <> "last" then if 0 < 0 then if `dsolve/numeric/checkglobals`(op(_dtbl[1][14]), _pars, _n, _y0) then `dsolve/numeric/SC/reinitialize`(_dtbl, _y0, _n, 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, _xout) 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][_nv+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] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val < _xout 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 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+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'; _xout := _val end if else error "cannot evaluate the solution further right of %1", evalf[8](_val) end if elif _i = 2 and _xout < _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 = _nv+1 then error "constraint projection failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+2 then error "index-1 and derivative evaluation failure on event at t=%1", evalf[8](_val) elif _dat[4][9]-100 = _nv+3 then error "maximum number of event iterations reached (%1) at t=%2", round(_dat[3][1][_nv+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'; _xout := _val end if else error "cannot evaluate the solution further left of %1", evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _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, _xout, _src); _dat[4][25] := _i; _dat[4][26] := _dig; [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] else Digits := _dat[4][26]; _val := `dsolve/numeric/SC/IVPval`(eval(_dat, 2), _xout, _src); [_xout, seq(_val[_vmap[_i]], _i = 1 .. _n-_ne)] end if end proc, (2) = Array(1..4, {(1) = 18446884266891554150, (2) = 18446884266891554326, (3) = 18446884266891554502, (4) = 18446884266891554678}), (3) = [t, phi(t), diff(phi(t), t), x(t)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(t, ["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(t, '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(t, ["last", 'last', "initial", 'initial', NULL]) then _res := _solnproc(convert(t, 'string')); if type(_res, 'list') then return _res[4] else return NULL end if elif member(t, ["parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(t, 'string'); _res := _solnproc(_xout); if _xout = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[4], seq(_pars[_i] = [_res][2][_i], _i = 1 .. nops(_pars))] end if elif type(_xout, `=`) and member(lhs(_xout), ["initial", 'initial', "parameters", 'parameters', "initial_and_parameters", 'initial_and_parameters', NULL]) then _xout := convert(lhs(t), 'string') = rhs(t); if lhs(_xout) = "initial" then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc("initial" = ["single", 4, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error "initial and/or parameter values must be specified in a list" elif lhs(_xout) = "initial_and_parameters" and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = ["single", 4, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = "initial" then return _res[4] elif lhs(_xout) = "parameters" then return [seq(_pars[_i] = _res[_i], _i = 1 .. nops(_pars))] else return [_res[4], 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', NULL]) then return _solnproc(convert(lhs(t), 'string') = rhs(t)) elif _xout = "solnprocedure" then return eval(_solnproc) elif _xout = "sysvars" then return _dat[3] end if; if procname <> unknown then return ('procname')(t) else _ndsol := 1; _ndsol := `tools/gensym`("x"); eval(FromInert(_Inert_FUNCTION(_Inert_NAME("assign"), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][4])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(t)))) end if end if; try _res := _solnproc(_xout); _res[4] catch: error  end try end proc]

odeplot(dsol, [t,phi(t)], t=0..20);

The oscillation period:

tmax := fsolve(eval(phi(t),dsol), t=10..20);

14.61643018

This proc produces a snapshot of the system at time "t."

We apply the neutral operators %disk, etc., in order to prescribe

the shape of the object before applying the numerical values in params.

frame := proc(t)
  local A, B, Disk, Hub, Rod, Bob;
  A := convert(r[1](x(t)), list);
  B := convert(r[2](x(t),phi(t)), list);
  Disk := %disk(A, R, color="Wheat");
  Hub  := %pointplot(A, symbol=solidcircle, symbolsize=30, color=black),
          %pointplot(A, symbol=solidcircle, symbolsize=20, color=white);
  Rod  := %plot([A,B], thickness=8, color=black);
  Bob  := %pointplot(B, symbol=solidcircle, symbolsize=50, color=red);
  eval([Disk, Rod, Bob, Hub], {dsol[], params});
  value(%);
  display(%);
end proc:

Produce a sequence of frames

frames := seq(frame(t), t=0..tmax, 0.15):

Animate

display([frames], insequence, scaling=constrained, tickmarks=[0,0]);


Download compound-pendulum.mw

You are attempting to solve two equations in the one unknown f.  I don't think that pdsolve is the right tool for such a thing.

It just happens that the two equations are compatible and you can solve them by hand if you do things carefully.  Here are the steps.

restart;

Writing x and xp for the variables is a good way of confusing

yourself.  I'd rather use x and y.

de1 := diff(f(x,y),x)=-(1/2)*(L*y+2*x)*kl;
de2 := diff(f(x,y),y)=-(1/4)*kl*L*(L*y+2*x);

diff(f(x, y), x) = -(1/2)*(L*y+2*x)*kl

diff(f(x, y), y) = -(1/4)*kl*L*(L*y+2*x)

Integrate de1 with respect to x.  The integration "constant"

can be any function of y:

tmp1 := int(lhs(de1), x) = int(rhs(de1),x) + g(y);

f(x, y) = -(1/2)*kl*(L*x*y+x^2)+g(y)

Differentiate the result, and then subtract from de2:

diff(tmp1, y);
tmp2 := simplify(de2 - %);

diff(f(x, y), y) = -(1/2)*kl*L*x+diff(g(y), y)

0 = -(1/4)*L^2*kl*y-(diff(g(y), y))

This is an ODE in g(y).  Solve it:

tmp3 := dsolve(tmp2);

g(y) = -(1/8)*L^2*kl*y^2+_C1

Plug this back into tmp1:

eval(tmp1, tmp3);

f(x, y) = -(1/2)*kl*(L*x*y+x^2)-(1/8)*L^2*kl*y^2+_C1

This is the function you are looking for, where _C1 is an

arbitrary constant.

 

Download mw.mw

 

 

In addition to Kitonum's solution, you may want to also look at the following recursive solution:

restart;
u := n -> sin(u(n-1));
u(0) := 1.5;

Then:

seq(u(n), n=0 .. 8);

 

Here is how it's done but check to be sure that what I have typed agrees with yours.

restart;

de_orig := diff(q(t),t) =
  f(p(e*t) + e*q(t), r(e*t) + s(t))
 -f(p(e*t), r(e*t) + s(t))
 -f(p(e*t), r(e*t));

diff(q(t), t) = f(p(e*t)+e*q(t), r(e*t)+s(t))-f(p(e*t), r(e*t)+s(t))-f(p(e*t), r(e*t))

de :=
eval(de_orig, {
  q(t) = q__0(t) + e*q__1(t),
  p(e*t) = p__0(e*t) + e*p__1(t),
  s(t) = s__q(t) + e*s__1(t),
  r(e*t) = r__0(e*t) + e*r__1(e*t)
});

diff(q__0(t), t)+e*(diff(q__1(t), t)) = f(p__0(e*t)+e*p__1(t)+e*(q__0(t)+e*q__1(t)), r__0(e*t)+e*r__1(e*t)+s__q(t)+e*s__1(t))-f(p__0(e*t)+e*p__1(t), r__0(e*t)+e*r__1(e*t)+s__q(t)+e*s__1(t))-f(p__0(e*t)+e*p__1(t), r__0(e*t)+e*r__1(e*t))

series(lhs(de)-rhs(de), e, 2) = 0:
convert(%, polynom):
collect(%, e, factor);

diff(q__0(t), t)+f(p__0(0), r__0(0))+(diff(q__1(t), t)-(D[1](f))(p__0(0), r__0(0)+s__q(t))*q__0(t)+(D[1](f))(p__0(0), r__0(0))*(D(p__0))(0)*t+(D[2](f))(p__0(0), r__0(0))*(D(r__0))(0)*t+(D[1](f))(p__0(0), r__0(0))*p__1(t)+(D[2](f))(p__0(0), r__0(0))*r__1(0))*e = 0

 

 

Download mw.mw

You have lambda, rho and p in your equations. To solve numerically, you need to assign numeric values to those.

P := seq([a,a^2], a=1..10, 0.5);
plot([P], style=point);

As an alternative to tomleslie's suggestion, here I show how to solve the differential equation numerically on the unbounded interval (0,∞).

restart;

plots:-setoptions(gridlines=false); # for posting on MaplePrimes

The exact solution

 

We calculate and plot the exact solution.

de := diff(theta(eta),eta,eta) + 2*eta*diff(theta(eta),eta) = 0;

diff(diff(theta(eta), eta), eta)+2*eta*(diff(theta(eta), eta)) = 0

bc := theta(0)=1, theta(infinity)=0;

theta(0) = 1, theta(infinity) = 0

sol_exact := dsolve({de,bc});

theta(eta) = 1-erf(eta)

p1 := plot(rhs(sol_exact), eta=0..infinity, color="Gold",
  thickness=11, labels=[eta, theta]);

 

The numerical solution

 

Now we calculate the same solution numerically.

Toward that end, we introduce the change of variable proc (eta) options operator, arrow; tan((1/2)*Pi*x) end proc

which maps the infinite interval 0 < eta and eta < infinity to the finite interval 0 < x and x < 1.

Let y(x) = theta(eta(x)).  The differential equation changes to:

DE_tmp := PDEtools:-dchange(
  {eta=tan(Pi/2*x), theta(eta)=y(x)}, de, [y(x), x]);

-4*((diff(y(x), x))*sin((1/2)*Pi*x)*Pi-(diff(diff(y(x), x), x))*cos((1/2)*Pi*x))*cos((1/2)*Pi*x)^3/Pi^2+4*tan((1/2)*Pi*x)*(diff(y(x), x))*cos((1/2)*Pi*x)^2/Pi = 0

We simplify the differential equation obtained above.

This is not strictly necessary -- we do it to show that the new

differential equation is actually quite simple, but the simplification

is immaterial to the numeric solver.

isolate(DE_tmp, diff(y(x),x,x)):
simplify(%):
DE := convert(%, tan);

diff(diff(y(x), x), x) = -(diff(y(x), x))*Pi*tan((1/2)*Pi*x)^3

The boundary conditions change to y(0) = 1, y(1) = 0.  Here is the numeric solution:

dsol := dsolve({DE, y(0)=1, y(1)=0}, numeric, output=listprocedure);

[x = proc (x) local _res, _dat, _solnproc; option `Copyright (c) 1993 by the University of Waterloo. All rights reserved.`; _dat := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(36, {(1) = .0, (2) = 0.2069864591778604e-1, (3) = 0.4485302928953022e-1, (4) = 0.7384281232178831e-1, (5) = .1094439981188813, (6) = .15033711061274824, (7) = .19158910252501452, (8) = .23194998642682346, (9) = .27095265196092505, (10) = .3080682002676446, (11) = .3428804467917584, (12) = .3751667115127215, (13) = .4049119252887474, (14) = .43230167583386175, (15) = .45762723898141516, (16) = .481211856065987, (17) = .5033817783578738, (18) = .5244639946248885, (19) = .5447378075649202, (20) = .5644663779248833, (21) = .5839003929211216, (22) = .603278189639884, (23) = .6228623781615171, (24) = .6429250326280463, (25) = .6637985391159033, (26) = .6858893854598224, (27) = .7097312188784993, (28) = .7360890857818543, (29) = .766125447166733, (30) = .801604684442461, (31) = .8442494008842528, (32) = .8899197913302994, (33) = .9261574287912433, (34) = .955146969425983, (35) = .9793013543831983, (36) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(36, 2, {(1, 1) = 1.0, (1, 2) = -1.7724538509849717, (2, 1) = .9633126094347239, (2, 2) = -1.772452859928948, (3, 1) = .920500271861266, (3, 2) = -1.77243194172902, (4, 1) = .8691194073052413, (4, 2) = -1.772291989207414, (5, 1) = .8060327473896298, (5, 2) = -1.7716644318029504, (6, 1) = .7336194933549142, (6, 2) = -1.769594398409635, (7, 1) = .6607078573857594, (7, 2) = -1.764739287166682, (8, 1) = .589650329018119, (8, 2) = -1.7554287127744552, (9, 1) = .5214633465635558, (9, 2) = -1.739781488593872, (10, 1) = .45729892004008843, (10, 2) = -1.716077701140258, (11, 1) = .39809770802170547, (11, 2) = -1.6830923849506296, (12, 1) = .34441231088130225, (12, 2) = -1.6402799538346113, (13, 1) = .2963688210052082, (13, 2) = -1.5877331701984876, (14, 1) = .2536960430700455, (14, 2) = -1.5258955300403192, (15, 1) = .21591642771968225, (15, 2) = -1.4553295497102816, (16, 1) = .18249569320260123, (16, 2) = -1.3765837669400183, (17, 1) = .1529126277273029, (17, 2) = -1.2900962515172394, (18, 1) = .1266849869928065, (18, 2) = -1.1961028205670343, (19, 1) = .10344401647957928, (19, 2) = -1.0948545289394114, (20, 1) = 0.8289694897139853e-1, (20, 2) = -.986594571188583, (21, 1) = 0.6482804043640726e-1, (21, 2) = -.8716844467469944, (22, 1) = 0.4909948840044154e-1, (22, 2) = -.7508345462567403, (23, 1) = 0.3562232725141094e-1, (23, 2) = -.6252051769021577, (24, 1) = 0.24370284899336025e-1, (24, 2) = -.4969651691154026, (25, 1) = 0.15342094583168974e-1, (25, 2) = -.36963370458761774, (26, 1) = 0.8543956662715955e-2, (26, 2) = -.2488662345294459, (27, 1) = 0.3930495142376994e-2, (27, 2) = -.142995118976792, (28, 1) = 0.131016792962599e-2, (28, 2) = -0.6247617488353338e-1, (29, 1) = 0.23802515481157586e-3, (29, 2) = -0.1605414655551743e-1, (30, 1) = 0.1132858065255846e-4, (30, 2) = -0.12310006086348518e-2, (31, 1) = 0.14150325077975986e-7, (31, 2) = -0.31964356769460945e-5, (32, 1) = 0.3465646006211683e-10, (32, 2) = -0.10640911419108412e-7, (33, 1) = -0.4341085721922779e-11, (33, 2) = 0.19444002805849586e-8, (34, 1) = 0.5927011992754512e-12, (34, 2) = -0.221549177240262e-9, (35, 1) = -0.845527183089716e-13, (35, 2) = 0.285488565751673e-10, (36, 1) = .0, (36, 2) = 0.2504840410528233e-49}, datatype = float[8], order = C_order); YP := Matrix(36, 2, {(1, 1) = -1.7724538509849717, (1, 2) = .0, (2, 1) = -1.772452859928948, (2, 2) = 0.19158840296201377e-3, (3, 1) = -1.77243194172902, (3, 2) = 0.19570986054474404e-2, (4, 1) = -1.772291989207414, (4, 2) = 0.8807059675517365e-2, (5, 1) = -1.7716644318029504, (5, 2) = 0.29133417520791616e-1, (6, 1) = -1.769594398409635, (6, 2) = 0.7746776374859068e-1, (7, 1) = -1.764739287166682, (7, 2) = .16576363291778407, (8, 1) = -1.7554287127744552, (8, 2) = .30590232458639566, (9, 1) = -1.739781488593872, (9, 2) = .5091658837783658, (10, 1) = -1.716077701140258, (10, 2) = .782776105705894, (11, 1) = -1.6830923849506296, (11, 2) = 1.1280262944464177, (12, 1) = -1.6402799538346113, (12, 2) = 1.539870235177221, (13, 1) = -1.5877331701984876, (13, 2) = 2.0081600636078276, (14, 1) = -1.5258955300403192, (14, 2) = 2.5203668644902684, (15, 1) = -1.4553295497102816, (15, 2) = 3.0630884003122762, (16, 1) = -1.3765837669400183, (16, 2) = 3.6224760785165118, (17, 1) = -1.2900962515172394, (17, 2) = 4.184217983708116, (18, 1) = -1.1961028205670343, (18, 2) = 4.733162333657354, (19, 1) = -1.0948545289394114, (19, 2) = 5.25085206289673, (20, 1) = -.986594571188583, (20, 2) = 5.714528243487643, (21, 1) = -.8716844467469944, (21, 2) = 6.094965488043455, (22, 1) = -.7508345462567403, (22, 2) = 6.35394544965113, (23, 1) = -.6252051769021577, (23, 2) = 6.4422458785674745, (24, 1) = -.4969651691154026, (24, 2) = 6.297914064437087, (25, 1) = -.36963370458761774, (25, 2) = 5.849012296353578, (26, 1) = -.2488662345294459, (26, 2) = 5.027247185226289, (27, 1) = -.142995118976792, (27, 2) = 3.80864362835014, (28, 1) = -0.6247617488353338e-1, (28, 2) = 2.303312257472058, (29, 1) = -0.1605414655551743e-1, (29, 2) = .8849062409009404, (30, 1) = -0.12310006086348518e-2, (30, 2) = .11568937557990648, (31, 1) = -0.31964356769460945e-5, (31, 2) = 0.6453616314590634e-3, (32, 1) = -0.10640911419108412e-7, (32, 2) = 0.6274295388169764e-5, (33, 1) = 0.19444002805849586e-8, (33, 2) = -0.3861837971758569e-5, (34, 1) = -0.221549177240262e-9, (34, 2) = 0.198028049587459e-5, (35, 1) = 0.285488565751673e-10, (35, 2) = -0.26067174510678828e-5, (36, 1) = 0.2504840410528233e-49, (36, 2) = 0.18488460862578966e-5}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(36, {(1) = .0, (2) = 0.2069864591778604e-1, (3) = 0.4485302928953022e-1, (4) = 0.7384281232178831e-1, (5) = .1094439981188813, (6) = .15033711061274824, (7) = .19158910252501452, (8) = .23194998642682346, (9) = .27095265196092505, (10) = .3080682002676446, (11) = .3428804467917584, (12) = .3751667115127215, (13) = .4049119252887474, (14) = .43230167583386175, (15) = .45762723898141516, (16) = .481211856065987, (17) = .5033817783578738, (18) = .5244639946248885, (19) = .5447378075649202, (20) = .5644663779248833, (21) = .5839003929211216, (22) = .603278189639884, (23) = .6228623781615171, (24) = .6429250326280463, (25) = .6637985391159033, (26) = .6858893854598224, (27) = .7097312188784993, (28) = .7360890857818543, (29) = .766125447166733, (30) = .801604684442461, (31) = .8442494008842528, (32) = .8899197913302994, (33) = .9261574287912433, (34) = .955146969425983, (35) = .9793013543831983, (36) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(36, 2, {(1, 1) = .0, (1, 2) = 0.850914110172803e-10, (2, 1) = 0.17611081299698337e-11, (2, 2) = 0.8509333211457741e-10, (3, 1) = 0.3817321516594867e-11, (3, 2) = 0.8509084970811107e-10, (4, 1) = 0.6283375057113273e-11, (4, 2) = 0.8508276258437863e-10, (5, 1) = 0.9313240892518212e-11, (5, 2) = 0.850524526248668e-10, (6, 1) = 0.12788440808566913e-10, (6, 2) = 0.8495196380498024e-10, (7, 1) = 0.16287135608660245e-10, (7, 2) = 0.8471304348543666e-10, (8, 1) = 0.19699611956392223e-10, (8, 2) = 0.8425997605647669e-10, (9, 1) = 0.22970703993197084e-10, (9, 2) = 0.8350285806489384e-10, (10, 1) = 0.26048598673130164e-10, (10, 2) = 0.8236141880485556e-10, (11, 1) = 0.28889564796709118e-10, (11, 2) = 0.807680075517535e-10, (12, 1) = 0.3146419432537857e-10, (12, 2) = 0.7870861850220935e-10, (13, 1) = 0.3376845440237838e-10, (13, 2) = 0.76180914278436e-10, (14, 1) = 0.3581545341839668e-10, (14, 2) = 0.7320630957736423e-10, (15, 1) = 0.3762747046980736e-10, (15, 2) = 0.6982232414596841e-10, (16, 1) = 0.39230212673005174e-10, (16, 2) = 0.6604258823731611e-10, (17, 1) = 0.4064875043426625e-10, (17, 2) = 0.6189293843978883e-10, (18, 1) = 0.41906632200038427e-10, (18, 2) = 0.5738158028963009e-10, (19, 1) = 0.4302087761928263e-10, (19, 2) = 0.5252587897070069e-10, (20, 1) = 0.4400625271793831e-10, (20, 2) = 0.473336495149119e-10, (21, 1) = 0.4487303893267542e-10, (21, 2) = 0.4182437851641992e-10, (22, 1) = 0.45627455433617764e-10, (22, 2) = 0.3603061078162274e-10, (23, 1) = 0.46274326233327936e-10, (23, 2) = 0.3000955859504699e-10, (24, 1) = 0.4681459707278807e-10, (24, 2) = 0.23860447426484826e-10, (25, 1) = 0.4724842787651142e-10, (25, 2) = 0.1776023517981049e-10, (26, 1) = 0.4757427285465771e-10, (26, 2) = 0.12017595400831685e-10, (27, 1) = 0.47790227471357375e-10, (27, 2) = 0.7328480716784074e-11, (28, 1) = 0.4795031656612425e-10, (28, 2) = 0.39031837281309675e-11, (29, 1) = 0.4883478028979934e-10, (29, 2) = -0.5718940225545175e-10, (30, 1) = 0.3230575568675054e-10, (30, 2) = 0.85712698691126e-9, (31, 1) = 0.5985832736634328e-9, (31, 2) = -0.5676350604244536e-7, (32, 1) = -0.4105497749547362e-10, (32, 2) = 0.12576565171542372e-7, (33, 1) = 0.52828639118618086e-11, (33, 2) = -0.25901087299107644e-8, (34, 1) = -0.6792883439476795e-12, (34, 2) = 0.2799012115279449e-9, (35, 1) = 0.9967786151379876e-13, (35, 2) = -0.37228995825150445e-10, (36, 1) = .0, (36, 2) = -0.3165528815230616e-49}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[36] elif outpoint = "order" then return 10 elif outpoint = "error" then return HFloat(5.676350604244536e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 36, [y(x), diff(y(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[36] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[36] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(36, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(36, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[y(x), diff(y(x), x)]'[i] = yout[i], i = 1 .. 2)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[36] elif outpoint = "order" then return 10 elif outpoint = "error" then return HFloat(5.676350604244536e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 36, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[36] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[36] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(36, 2, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(36, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446884691877884342, (2) = 18446884691877887510, (3) = 18446884691877881918}), (3) = [x, y(x), diff(y(x), x)], (4) = 0}); _solnproc := _dat[1]; if member(x, ["last", 'last']) then _res := _solnproc("last"); if type(_res, 'list') then return _res[1] end if elif type(x, `=`) and member(lhs(x), ["initial", 'initial']) then if type(rhs(x), 'list') then _res := _solnproc("initial" = [0, op(rhs(x))]) else _res := _solnproc("initial" = [1, rhs(x)]) end if; if type(_res, 'list') then return _res[1] end if elif x = "sysvars" then return _dat[3] end if; x end proc, y(x) = proc (x) local res, data, solnproc, `y(x)`, outpoint; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x) else outpoint := evalf(x) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(36, {(1) = .0, (2) = 0.2069864591778604e-1, (3) = 0.4485302928953022e-1, (4) = 0.7384281232178831e-1, (5) = .1094439981188813, (6) = .15033711061274824, (7) = .19158910252501452, (8) = .23194998642682346, (9) = .27095265196092505, (10) = .3080682002676446, (11) = .3428804467917584, (12) = .3751667115127215, (13) = .4049119252887474, (14) = .43230167583386175, (15) = .45762723898141516, (16) = .481211856065987, (17) = .5033817783578738, (18) = .5244639946248885, (19) = .5447378075649202, (20) = .5644663779248833, (21) = .5839003929211216, (22) = .603278189639884, (23) = .6228623781615171, (24) = .6429250326280463, (25) = .6637985391159033, (26) = .6858893854598224, (27) = .7097312188784993, (28) = .7360890857818543, (29) = .766125447166733, (30) = .801604684442461, (31) = .8442494008842528, (32) = .8899197913302994, (33) = .9261574287912433, (34) = .955146969425983, (35) = .9793013543831983, (36) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(36, 2, {(1, 1) = 1.0, (1, 2) = -1.7724538509849717, (2, 1) = .9633126094347239, (2, 2) = -1.772452859928948, (3, 1) = .920500271861266, (3, 2) = -1.77243194172902, (4, 1) = .8691194073052413, (4, 2) = -1.772291989207414, (5, 1) = .8060327473896298, (5, 2) = -1.7716644318029504, (6, 1) = .7336194933549142, (6, 2) = -1.769594398409635, (7, 1) = .6607078573857594, (7, 2) = -1.764739287166682, (8, 1) = .589650329018119, (8, 2) = -1.7554287127744552, (9, 1) = .5214633465635558, (9, 2) = -1.739781488593872, (10, 1) = .45729892004008843, (10, 2) = -1.716077701140258, (11, 1) = .39809770802170547, (11, 2) = -1.6830923849506296, (12, 1) = .34441231088130225, (12, 2) = -1.6402799538346113, (13, 1) = .2963688210052082, (13, 2) = -1.5877331701984876, (14, 1) = .2536960430700455, (14, 2) = -1.5258955300403192, (15, 1) = .21591642771968225, (15, 2) = -1.4553295497102816, (16, 1) = .18249569320260123, (16, 2) = -1.3765837669400183, (17, 1) = .1529126277273029, (17, 2) = -1.2900962515172394, (18, 1) = .1266849869928065, (18, 2) = -1.1961028205670343, (19, 1) = .10344401647957928, (19, 2) = -1.0948545289394114, (20, 1) = 0.8289694897139853e-1, (20, 2) = -.986594571188583, (21, 1) = 0.6482804043640726e-1, (21, 2) = -.8716844467469944, (22, 1) = 0.4909948840044154e-1, (22, 2) = -.7508345462567403, (23, 1) = 0.3562232725141094e-1, (23, 2) = -.6252051769021577, (24, 1) = 0.24370284899336025e-1, (24, 2) = -.4969651691154026, (25, 1) = 0.15342094583168974e-1, (25, 2) = -.36963370458761774, (26, 1) = 0.8543956662715955e-2, (26, 2) = -.2488662345294459, (27, 1) = 0.3930495142376994e-2, (27, 2) = -.142995118976792, (28, 1) = 0.131016792962599e-2, (28, 2) = -0.6247617488353338e-1, (29, 1) = 0.23802515481157586e-3, (29, 2) = -0.1605414655551743e-1, (30, 1) = 0.1132858065255846e-4, (30, 2) = -0.12310006086348518e-2, (31, 1) = 0.14150325077975986e-7, (31, 2) = -0.31964356769460945e-5, (32, 1) = 0.3465646006211683e-10, (32, 2) = -0.10640911419108412e-7, (33, 1) = -0.4341085721922779e-11, (33, 2) = 0.19444002805849586e-8, (34, 1) = 0.5927011992754512e-12, (34, 2) = -0.221549177240262e-9, (35, 1) = -0.845527183089716e-13, (35, 2) = 0.285488565751673e-10, (36, 1) = .0, (36, 2) = 0.2504840410528233e-49}, datatype = float[8], order = C_order); YP := Matrix(36, 2, {(1, 1) = -1.7724538509849717, (1, 2) = .0, (2, 1) = -1.772452859928948, (2, 2) = 0.19158840296201377e-3, (3, 1) = -1.77243194172902, (3, 2) = 0.19570986054474404e-2, (4, 1) = -1.772291989207414, (4, 2) = 0.8807059675517365e-2, (5, 1) = -1.7716644318029504, (5, 2) = 0.29133417520791616e-1, (6, 1) = -1.769594398409635, (6, 2) = 0.7746776374859068e-1, (7, 1) = -1.764739287166682, (7, 2) = .16576363291778407, (8, 1) = -1.7554287127744552, (8, 2) = .30590232458639566, (9, 1) = -1.739781488593872, (9, 2) = .5091658837783658, (10, 1) = -1.716077701140258, (10, 2) = .782776105705894, (11, 1) = -1.6830923849506296, (11, 2) = 1.1280262944464177, (12, 1) = -1.6402799538346113, (12, 2) = 1.539870235177221, (13, 1) = -1.5877331701984876, (13, 2) = 2.0081600636078276, (14, 1) = -1.5258955300403192, (14, 2) = 2.5203668644902684, (15, 1) = -1.4553295497102816, (15, 2) = 3.0630884003122762, (16, 1) = -1.3765837669400183, (16, 2) = 3.6224760785165118, (17, 1) = -1.2900962515172394, (17, 2) = 4.184217983708116, (18, 1) = -1.1961028205670343, (18, 2) = 4.733162333657354, (19, 1) = -1.0948545289394114, (19, 2) = 5.25085206289673, (20, 1) = -.986594571188583, (20, 2) = 5.714528243487643, (21, 1) = -.8716844467469944, (21, 2) = 6.094965488043455, (22, 1) = -.7508345462567403, (22, 2) = 6.35394544965113, (23, 1) = -.6252051769021577, (23, 2) = 6.4422458785674745, (24, 1) = -.4969651691154026, (24, 2) = 6.297914064437087, (25, 1) = -.36963370458761774, (25, 2) = 5.849012296353578, (26, 1) = -.2488662345294459, (26, 2) = 5.027247185226289, (27, 1) = -.142995118976792, (27, 2) = 3.80864362835014, (28, 1) = -0.6247617488353338e-1, (28, 2) = 2.303312257472058, (29, 1) = -0.1605414655551743e-1, (29, 2) = .8849062409009404, (30, 1) = -0.12310006086348518e-2, (30, 2) = .11568937557990648, (31, 1) = -0.31964356769460945e-5, (31, 2) = 0.6453616314590634e-3, (32, 1) = -0.10640911419108412e-7, (32, 2) = 0.6274295388169764e-5, (33, 1) = 0.19444002805849586e-8, (33, 2) = -0.3861837971758569e-5, (34, 1) = -0.221549177240262e-9, (34, 2) = 0.198028049587459e-5, (35, 1) = 0.285488565751673e-10, (35, 2) = -0.26067174510678828e-5, (36, 1) = 0.2504840410528233e-49, (36, 2) = 0.18488460862578966e-5}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(36, {(1) = .0, (2) = 0.2069864591778604e-1, (3) = 0.4485302928953022e-1, (4) = 0.7384281232178831e-1, (5) = .1094439981188813, (6) = .15033711061274824, (7) = .19158910252501452, (8) = .23194998642682346, (9) = .27095265196092505, (10) = .3080682002676446, (11) = .3428804467917584, (12) = .3751667115127215, (13) = .4049119252887474, (14) = .43230167583386175, (15) = .45762723898141516, (16) = .481211856065987, (17) = .5033817783578738, (18) = .5244639946248885, (19) = .5447378075649202, (20) = .5644663779248833, (21) = .5839003929211216, (22) = .603278189639884, (23) = .6228623781615171, (24) = .6429250326280463, (25) = .6637985391159033, (26) = .6858893854598224, (27) = .7097312188784993, (28) = .7360890857818543, (29) = .766125447166733, (30) = .801604684442461, (31) = .8442494008842528, (32) = .8899197913302994, (33) = .9261574287912433, (34) = .955146969425983, (35) = .9793013543831983, (36) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(36, 2, {(1, 1) = .0, (1, 2) = 0.850914110172803e-10, (2, 1) = 0.17611081299698337e-11, (2, 2) = 0.8509333211457741e-10, (3, 1) = 0.3817321516594867e-11, (3, 2) = 0.8509084970811107e-10, (4, 1) = 0.6283375057113273e-11, (4, 2) = 0.8508276258437863e-10, (5, 1) = 0.9313240892518212e-11, (5, 2) = 0.850524526248668e-10, (6, 1) = 0.12788440808566913e-10, (6, 2) = 0.8495196380498024e-10, (7, 1) = 0.16287135608660245e-10, (7, 2) = 0.8471304348543666e-10, (8, 1) = 0.19699611956392223e-10, (8, 2) = 0.8425997605647669e-10, (9, 1) = 0.22970703993197084e-10, (9, 2) = 0.8350285806489384e-10, (10, 1) = 0.26048598673130164e-10, (10, 2) = 0.8236141880485556e-10, (11, 1) = 0.28889564796709118e-10, (11, 2) = 0.807680075517535e-10, (12, 1) = 0.3146419432537857e-10, (12, 2) = 0.7870861850220935e-10, (13, 1) = 0.3376845440237838e-10, (13, 2) = 0.76180914278436e-10, (14, 1) = 0.3581545341839668e-10, (14, 2) = 0.7320630957736423e-10, (15, 1) = 0.3762747046980736e-10, (15, 2) = 0.6982232414596841e-10, (16, 1) = 0.39230212673005174e-10, (16, 2) = 0.6604258823731611e-10, (17, 1) = 0.4064875043426625e-10, (17, 2) = 0.6189293843978883e-10, (18, 1) = 0.41906632200038427e-10, (18, 2) = 0.5738158028963009e-10, (19, 1) = 0.4302087761928263e-10, (19, 2) = 0.5252587897070069e-10, (20, 1) = 0.4400625271793831e-10, (20, 2) = 0.473336495149119e-10, (21, 1) = 0.4487303893267542e-10, (21, 2) = 0.4182437851641992e-10, (22, 1) = 0.45627455433617764e-10, (22, 2) = 0.3603061078162274e-10, (23, 1) = 0.46274326233327936e-10, (23, 2) = 0.3000955859504699e-10, (24, 1) = 0.4681459707278807e-10, (24, 2) = 0.23860447426484826e-10, (25, 1) = 0.4724842787651142e-10, (25, 2) = 0.1776023517981049e-10, (26, 1) = 0.4757427285465771e-10, (26, 2) = 0.12017595400831685e-10, (27, 1) = 0.47790227471357375e-10, (27, 2) = 0.7328480716784074e-11, (28, 1) = 0.4795031656612425e-10, (28, 2) = 0.39031837281309675e-11, (29, 1) = 0.4883478028979934e-10, (29, 2) = -0.5718940225545175e-10, (30, 1) = 0.3230575568675054e-10, (30, 2) = 0.85712698691126e-9, (31, 1) = 0.5985832736634328e-9, (31, 2) = -0.5676350604244536e-7, (32, 1) = -0.4105497749547362e-10, (32, 2) = 0.12576565171542372e-7, (33, 1) = 0.52828639118618086e-11, (33, 2) = -0.25901087299107644e-8, (34, 1) = -0.6792883439476795e-12, (34, 2) = 0.2799012115279449e-9, (35, 1) = 0.9967786151379876e-13, (35, 2) = -0.37228995825150445e-10, (36, 1) = .0, (36, 2) = -0.3165528815230616e-49}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[36] elif outpoint = "order" then return 10 elif outpoint = "error" then return HFloat(5.676350604244536e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 36, [y(x), diff(y(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[36] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[36] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(36, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(36, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[y(x), diff(y(x), x)]'[i] = yout[i], i = 1 .. 2)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[36] elif outpoint = "order" then return 10 elif outpoint = "error" then return HFloat(5.676350604244536e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 36, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[36] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[36] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(36, 2, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(36, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446884691877884342, (2) = 18446884691877887510, (3) = 18446884691877881918}), (3) = [x, y(x), diff(y(x), x)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x) else `y(x)` := pointto(data[2][2]); return ('`y(x)`')(x) end if end if; try res := solnproc(outpoint); res[2] catch: error  end try end proc, diff(y(x), x) = proc (x) local res, data, solnproc, `diff(y(x),x)`, outpoint; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x) else outpoint := evalf(x) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(36, {(1) = .0, (2) = 0.2069864591778604e-1, (3) = 0.4485302928953022e-1, (4) = 0.7384281232178831e-1, (5) = .1094439981188813, (6) = .15033711061274824, (7) = .19158910252501452, (8) = .23194998642682346, (9) = .27095265196092505, (10) = .3080682002676446, (11) = .3428804467917584, (12) = .3751667115127215, (13) = .4049119252887474, (14) = .43230167583386175, (15) = .45762723898141516, (16) = .481211856065987, (17) = .5033817783578738, (18) = .5244639946248885, (19) = .5447378075649202, (20) = .5644663779248833, (21) = .5839003929211216, (22) = .603278189639884, (23) = .6228623781615171, (24) = .6429250326280463, (25) = .6637985391159033, (26) = .6858893854598224, (27) = .7097312188784993, (28) = .7360890857818543, (29) = .766125447166733, (30) = .801604684442461, (31) = .8442494008842528, (32) = .8899197913302994, (33) = .9261574287912433, (34) = .955146969425983, (35) = .9793013543831983, (36) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(36, 2, {(1, 1) = 1.0, (1, 2) = -1.7724538509849717, (2, 1) = .9633126094347239, (2, 2) = -1.772452859928948, (3, 1) = .920500271861266, (3, 2) = -1.77243194172902, (4, 1) = .8691194073052413, (4, 2) = -1.772291989207414, (5, 1) = .8060327473896298, (5, 2) = -1.7716644318029504, (6, 1) = .7336194933549142, (6, 2) = -1.769594398409635, (7, 1) = .6607078573857594, (7, 2) = -1.764739287166682, (8, 1) = .589650329018119, (8, 2) = -1.7554287127744552, (9, 1) = .5214633465635558, (9, 2) = -1.739781488593872, (10, 1) = .45729892004008843, (10, 2) = -1.716077701140258, (11, 1) = .39809770802170547, (11, 2) = -1.6830923849506296, (12, 1) = .34441231088130225, (12, 2) = -1.6402799538346113, (13, 1) = .2963688210052082, (13, 2) = -1.5877331701984876, (14, 1) = .2536960430700455, (14, 2) = -1.5258955300403192, (15, 1) = .21591642771968225, (15, 2) = -1.4553295497102816, (16, 1) = .18249569320260123, (16, 2) = -1.3765837669400183, (17, 1) = .1529126277273029, (17, 2) = -1.2900962515172394, (18, 1) = .1266849869928065, (18, 2) = -1.1961028205670343, (19, 1) = .10344401647957928, (19, 2) = -1.0948545289394114, (20, 1) = 0.8289694897139853e-1, (20, 2) = -.986594571188583, (21, 1) = 0.6482804043640726e-1, (21, 2) = -.8716844467469944, (22, 1) = 0.4909948840044154e-1, (22, 2) = -.7508345462567403, (23, 1) = 0.3562232725141094e-1, (23, 2) = -.6252051769021577, (24, 1) = 0.24370284899336025e-1, (24, 2) = -.4969651691154026, (25, 1) = 0.15342094583168974e-1, (25, 2) = -.36963370458761774, (26, 1) = 0.8543956662715955e-2, (26, 2) = -.2488662345294459, (27, 1) = 0.3930495142376994e-2, (27, 2) = -.142995118976792, (28, 1) = 0.131016792962599e-2, (28, 2) = -0.6247617488353338e-1, (29, 1) = 0.23802515481157586e-3, (29, 2) = -0.1605414655551743e-1, (30, 1) = 0.1132858065255846e-4, (30, 2) = -0.12310006086348518e-2, (31, 1) = 0.14150325077975986e-7, (31, 2) = -0.31964356769460945e-5, (32, 1) = 0.3465646006211683e-10, (32, 2) = -0.10640911419108412e-7, (33, 1) = -0.4341085721922779e-11, (33, 2) = 0.19444002805849586e-8, (34, 1) = 0.5927011992754512e-12, (34, 2) = -0.221549177240262e-9, (35, 1) = -0.845527183089716e-13, (35, 2) = 0.285488565751673e-10, (36, 1) = .0, (36, 2) = 0.2504840410528233e-49}, datatype = float[8], order = C_order); YP := Matrix(36, 2, {(1, 1) = -1.7724538509849717, (1, 2) = .0, (2, 1) = -1.772452859928948, (2, 2) = 0.19158840296201377e-3, (3, 1) = -1.77243194172902, (3, 2) = 0.19570986054474404e-2, (4, 1) = -1.772291989207414, (4, 2) = 0.8807059675517365e-2, (5, 1) = -1.7716644318029504, (5, 2) = 0.29133417520791616e-1, (6, 1) = -1.769594398409635, (6, 2) = 0.7746776374859068e-1, (7, 1) = -1.764739287166682, (7, 2) = .16576363291778407, (8, 1) = -1.7554287127744552, (8, 2) = .30590232458639566, (9, 1) = -1.739781488593872, (9, 2) = .5091658837783658, (10, 1) = -1.716077701140258, (10, 2) = .782776105705894, (11, 1) = -1.6830923849506296, (11, 2) = 1.1280262944464177, (12, 1) = -1.6402799538346113, (12, 2) = 1.539870235177221, (13, 1) = -1.5877331701984876, (13, 2) = 2.0081600636078276, (14, 1) = -1.5258955300403192, (14, 2) = 2.5203668644902684, (15, 1) = -1.4553295497102816, (15, 2) = 3.0630884003122762, (16, 1) = -1.3765837669400183, (16, 2) = 3.6224760785165118, (17, 1) = -1.2900962515172394, (17, 2) = 4.184217983708116, (18, 1) = -1.1961028205670343, (18, 2) = 4.733162333657354, (19, 1) = -1.0948545289394114, (19, 2) = 5.25085206289673, (20, 1) = -.986594571188583, (20, 2) = 5.714528243487643, (21, 1) = -.8716844467469944, (21, 2) = 6.094965488043455, (22, 1) = -.7508345462567403, (22, 2) = 6.35394544965113, (23, 1) = -.6252051769021577, (23, 2) = 6.4422458785674745, (24, 1) = -.4969651691154026, (24, 2) = 6.297914064437087, (25, 1) = -.36963370458761774, (25, 2) = 5.849012296353578, (26, 1) = -.2488662345294459, (26, 2) = 5.027247185226289, (27, 1) = -.142995118976792, (27, 2) = 3.80864362835014, (28, 1) = -0.6247617488353338e-1, (28, 2) = 2.303312257472058, (29, 1) = -0.1605414655551743e-1, (29, 2) = .8849062409009404, (30, 1) = -0.12310006086348518e-2, (30, 2) = .11568937557990648, (31, 1) = -0.31964356769460945e-5, (31, 2) = 0.6453616314590634e-3, (32, 1) = -0.10640911419108412e-7, (32, 2) = 0.6274295388169764e-5, (33, 1) = 0.19444002805849586e-8, (33, 2) = -0.3861837971758569e-5, (34, 1) = -0.221549177240262e-9, (34, 2) = 0.198028049587459e-5, (35, 1) = 0.285488565751673e-10, (35, 2) = -0.26067174510678828e-5, (36, 1) = 0.2504840410528233e-49, (36, 2) = 0.18488460862578966e-5}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(36, {(1) = .0, (2) = 0.2069864591778604e-1, (3) = 0.4485302928953022e-1, (4) = 0.7384281232178831e-1, (5) = .1094439981188813, (6) = .15033711061274824, (7) = .19158910252501452, (8) = .23194998642682346, (9) = .27095265196092505, (10) = .3080682002676446, (11) = .3428804467917584, (12) = .3751667115127215, (13) = .4049119252887474, (14) = .43230167583386175, (15) = .45762723898141516, (16) = .481211856065987, (17) = .5033817783578738, (18) = .5244639946248885, (19) = .5447378075649202, (20) = .5644663779248833, (21) = .5839003929211216, (22) = .603278189639884, (23) = .6228623781615171, (24) = .6429250326280463, (25) = .6637985391159033, (26) = .6858893854598224, (27) = .7097312188784993, (28) = .7360890857818543, (29) = .766125447166733, (30) = .801604684442461, (31) = .8442494008842528, (32) = .8899197913302994, (33) = .9261574287912433, (34) = .955146969425983, (35) = .9793013543831983, (36) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(36, 2, {(1, 1) = .0, (1, 2) = 0.850914110172803e-10, (2, 1) = 0.17611081299698337e-11, (2, 2) = 0.8509333211457741e-10, (3, 1) = 0.3817321516594867e-11, (3, 2) = 0.8509084970811107e-10, (4, 1) = 0.6283375057113273e-11, (4, 2) = 0.8508276258437863e-10, (5, 1) = 0.9313240892518212e-11, (5, 2) = 0.850524526248668e-10, (6, 1) = 0.12788440808566913e-10, (6, 2) = 0.8495196380498024e-10, (7, 1) = 0.16287135608660245e-10, (7, 2) = 0.8471304348543666e-10, (8, 1) = 0.19699611956392223e-10, (8, 2) = 0.8425997605647669e-10, (9, 1) = 0.22970703993197084e-10, (9, 2) = 0.8350285806489384e-10, (10, 1) = 0.26048598673130164e-10, (10, 2) = 0.8236141880485556e-10, (11, 1) = 0.28889564796709118e-10, (11, 2) = 0.807680075517535e-10, (12, 1) = 0.3146419432537857e-10, (12, 2) = 0.7870861850220935e-10, (13, 1) = 0.3376845440237838e-10, (13, 2) = 0.76180914278436e-10, (14, 1) = 0.3581545341839668e-10, (14, 2) = 0.7320630957736423e-10, (15, 1) = 0.3762747046980736e-10, (15, 2) = 0.6982232414596841e-10, (16, 1) = 0.39230212673005174e-10, (16, 2) = 0.6604258823731611e-10, (17, 1) = 0.4064875043426625e-10, (17, 2) = 0.6189293843978883e-10, (18, 1) = 0.41906632200038427e-10, (18, 2) = 0.5738158028963009e-10, (19, 1) = 0.4302087761928263e-10, (19, 2) = 0.5252587897070069e-10, (20, 1) = 0.4400625271793831e-10, (20, 2) = 0.473336495149119e-10, (21, 1) = 0.4487303893267542e-10, (21, 2) = 0.4182437851641992e-10, (22, 1) = 0.45627455433617764e-10, (22, 2) = 0.3603061078162274e-10, (23, 1) = 0.46274326233327936e-10, (23, 2) = 0.3000955859504699e-10, (24, 1) = 0.4681459707278807e-10, (24, 2) = 0.23860447426484826e-10, (25, 1) = 0.4724842787651142e-10, (25, 2) = 0.1776023517981049e-10, (26, 1) = 0.4757427285465771e-10, (26, 2) = 0.12017595400831685e-10, (27, 1) = 0.47790227471357375e-10, (27, 2) = 0.7328480716784074e-11, (28, 1) = 0.4795031656612425e-10, (28, 2) = 0.39031837281309675e-11, (29, 1) = 0.4883478028979934e-10, (29, 2) = -0.5718940225545175e-10, (30, 1) = 0.3230575568675054e-10, (30, 2) = 0.85712698691126e-9, (31, 1) = 0.5985832736634328e-9, (31, 2) = -0.5676350604244536e-7, (32, 1) = -0.4105497749547362e-10, (32, 2) = 0.12576565171542372e-7, (33, 1) = 0.52828639118618086e-11, (33, 2) = -0.25901087299107644e-8, (34, 1) = -0.6792883439476795e-12, (34, 2) = 0.2799012115279449e-9, (35, 1) = 0.9967786151379876e-13, (35, 2) = -0.37228995825150445e-10, (36, 1) = .0, (36, 2) = -0.3165528815230616e-49}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[36] elif outpoint = "order" then return 10 elif outpoint = "error" then return HFloat(5.676350604244536e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 36, [y(x), diff(y(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[36] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[36] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(36, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(36, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[y(x), diff(y(x), x)]'[i] = yout[i], i = 1 .. 2)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[36] elif outpoint = "order" then return 10 elif outpoint = "error" then return HFloat(5.676350604244536e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 36, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[36] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[36] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(36, 2, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(36, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446884691877884342, (2) = 18446884691877887510, (3) = 18446884691877881918}), (3) = [x, y(x), diff(y(x), x)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x) else `diff(y(x),x)` := pointto(data[2][3]); return ('`diff(y(x),x)`')(x) end if end if; try res := solnproc(outpoint); res[3] catch: error  end try end proc]

We extract the solution y(x):

tmp1 := eval(y(x), dsol);

proc (x) local res, data, solnproc, `y(x)`, outpoint; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x) else outpoint := evalf(x) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(36, {(1) = .0, (2) = 0.2069864591778604e-1, (3) = 0.4485302928953022e-1, (4) = 0.7384281232178831e-1, (5) = .1094439981188813, (6) = .15033711061274824, (7) = .19158910252501452, (8) = .23194998642682346, (9) = .27095265196092505, (10) = .3080682002676446, (11) = .3428804467917584, (12) = .3751667115127215, (13) = .4049119252887474, (14) = .43230167583386175, (15) = .45762723898141516, (16) = .481211856065987, (17) = .5033817783578738, (18) = .5244639946248885, (19) = .5447378075649202, (20) = .5644663779248833, (21) = .5839003929211216, (22) = .603278189639884, (23) = .6228623781615171, (24) = .6429250326280463, (25) = .6637985391159033, (26) = .6858893854598224, (27) = .7097312188784993, (28) = .7360890857818543, (29) = .766125447166733, (30) = .801604684442461, (31) = .8442494008842528, (32) = .8899197913302994, (33) = .9261574287912433, (34) = .955146969425983, (35) = .9793013543831983, (36) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(36, 2, {(1, 1) = 1.0, (1, 2) = -1.7724538509849717, (2, 1) = .9633126094347239, (2, 2) = -1.772452859928948, (3, 1) = .920500271861266, (3, 2) = -1.77243194172902, (4, 1) = .8691194073052413, (4, 2) = -1.772291989207414, (5, 1) = .8060327473896298, (5, 2) = -1.7716644318029504, (6, 1) = .7336194933549142, (6, 2) = -1.769594398409635, (7, 1) = .6607078573857594, (7, 2) = -1.764739287166682, (8, 1) = .589650329018119, (8, 2) = -1.7554287127744552, (9, 1) = .5214633465635558, (9, 2) = -1.739781488593872, (10, 1) = .45729892004008843, (10, 2) = -1.716077701140258, (11, 1) = .39809770802170547, (11, 2) = -1.6830923849506296, (12, 1) = .34441231088130225, (12, 2) = -1.6402799538346113, (13, 1) = .2963688210052082, (13, 2) = -1.5877331701984876, (14, 1) = .2536960430700455, (14, 2) = -1.5258955300403192, (15, 1) = .21591642771968225, (15, 2) = -1.4553295497102816, (16, 1) = .18249569320260123, (16, 2) = -1.3765837669400183, (17, 1) = .1529126277273029, (17, 2) = -1.2900962515172394, (18, 1) = .1266849869928065, (18, 2) = -1.1961028205670343, (19, 1) = .10344401647957928, (19, 2) = -1.0948545289394114, (20, 1) = 0.8289694897139853e-1, (20, 2) = -.986594571188583, (21, 1) = 0.6482804043640726e-1, (21, 2) = -.8716844467469944, (22, 1) = 0.4909948840044154e-1, (22, 2) = -.7508345462567403, (23, 1) = 0.3562232725141094e-1, (23, 2) = -.6252051769021577, (24, 1) = 0.24370284899336025e-1, (24, 2) = -.4969651691154026, (25, 1) = 0.15342094583168974e-1, (25, 2) = -.36963370458761774, (26, 1) = 0.8543956662715955e-2, (26, 2) = -.2488662345294459, (27, 1) = 0.3930495142376994e-2, (27, 2) = -.142995118976792, (28, 1) = 0.131016792962599e-2, (28, 2) = -0.6247617488353338e-1, (29, 1) = 0.23802515481157586e-3, (29, 2) = -0.1605414655551743e-1, (30, 1) = 0.1132858065255846e-4, (30, 2) = -0.12310006086348518e-2, (31, 1) = 0.14150325077975986e-7, (31, 2) = -0.31964356769460945e-5, (32, 1) = 0.3465646006211683e-10, (32, 2) = -0.10640911419108412e-7, (33, 1) = -0.4341085721922779e-11, (33, 2) = 0.19444002805849586e-8, (34, 1) = 0.5927011992754512e-12, (34, 2) = -0.221549177240262e-9, (35, 1) = -0.845527183089716e-13, (35, 2) = 0.285488565751673e-10, (36, 1) = .0, (36, 2) = 0.2504840410528233e-49}, datatype = float[8], order = C_order); YP := Matrix(36, 2, {(1, 1) = -1.7724538509849717, (1, 2) = .0, (2, 1) = -1.772452859928948, (2, 2) = 0.19158840296201377e-3, (3, 1) = -1.77243194172902, (3, 2) = 0.19570986054474404e-2, (4, 1) = -1.772291989207414, (4, 2) = 0.8807059675517365e-2, (5, 1) = -1.7716644318029504, (5, 2) = 0.29133417520791616e-1, (6, 1) = -1.769594398409635, (6, 2) = 0.7746776374859068e-1, (7, 1) = -1.764739287166682, (7, 2) = .16576363291778407, (8, 1) = -1.7554287127744552, (8, 2) = .30590232458639566, (9, 1) = -1.739781488593872, (9, 2) = .5091658837783658, (10, 1) = -1.716077701140258, (10, 2) = .782776105705894, (11, 1) = -1.6830923849506296, (11, 2) = 1.1280262944464177, (12, 1) = -1.6402799538346113, (12, 2) = 1.539870235177221, (13, 1) = -1.5877331701984876, (13, 2) = 2.0081600636078276, (14, 1) = -1.5258955300403192, (14, 2) = 2.5203668644902684, (15, 1) = -1.4553295497102816, (15, 2) = 3.0630884003122762, (16, 1) = -1.3765837669400183, (16, 2) = 3.6224760785165118, (17, 1) = -1.2900962515172394, (17, 2) = 4.184217983708116, (18, 1) = -1.1961028205670343, (18, 2) = 4.733162333657354, (19, 1) = -1.0948545289394114, (19, 2) = 5.25085206289673, (20, 1) = -.986594571188583, (20, 2) = 5.714528243487643, (21, 1) = -.8716844467469944, (21, 2) = 6.094965488043455, (22, 1) = -.7508345462567403, (22, 2) = 6.35394544965113, (23, 1) = -.6252051769021577, (23, 2) = 6.4422458785674745, (24, 1) = -.4969651691154026, (24, 2) = 6.297914064437087, (25, 1) = -.36963370458761774, (25, 2) = 5.849012296353578, (26, 1) = -.2488662345294459, (26, 2) = 5.027247185226289, (27, 1) = -.142995118976792, (27, 2) = 3.80864362835014, (28, 1) = -0.6247617488353338e-1, (28, 2) = 2.303312257472058, (29, 1) = -0.1605414655551743e-1, (29, 2) = .8849062409009404, (30, 1) = -0.12310006086348518e-2, (30, 2) = .11568937557990648, (31, 1) = -0.31964356769460945e-5, (31, 2) = 0.6453616314590634e-3, (32, 1) = -0.10640911419108412e-7, (32, 2) = 0.6274295388169764e-5, (33, 1) = 0.19444002805849586e-8, (33, 2) = -0.3861837971758569e-5, (34, 1) = -0.221549177240262e-9, (34, 2) = 0.198028049587459e-5, (35, 1) = 0.285488565751673e-10, (35, 2) = -0.26067174510678828e-5, (36, 1) = 0.2504840410528233e-49, (36, 2) = 0.18488460862578966e-5}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(36, {(1) = .0, (2) = 0.2069864591778604e-1, (3) = 0.4485302928953022e-1, (4) = 0.7384281232178831e-1, (5) = .1094439981188813, (6) = .15033711061274824, (7) = .19158910252501452, (8) = .23194998642682346, (9) = .27095265196092505, (10) = .3080682002676446, (11) = .3428804467917584, (12) = .3751667115127215, (13) = .4049119252887474, (14) = .43230167583386175, (15) = .45762723898141516, (16) = .481211856065987, (17) = .5033817783578738, (18) = .5244639946248885, (19) = .5447378075649202, (20) = .5644663779248833, (21) = .5839003929211216, (22) = .603278189639884, (23) = .6228623781615171, (24) = .6429250326280463, (25) = .6637985391159033, (26) = .6858893854598224, (27) = .7097312188784993, (28) = .7360890857818543, (29) = .766125447166733, (30) = .801604684442461, (31) = .8442494008842528, (32) = .8899197913302994, (33) = .9261574287912433, (34) = .955146969425983, (35) = .9793013543831983, (36) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(36, 2, {(1, 1) = .0, (1, 2) = 0.850914110172803e-10, (2, 1) = 0.17611081299698337e-11, (2, 2) = 0.8509333211457741e-10, (3, 1) = 0.3817321516594867e-11, (3, 2) = 0.8509084970811107e-10, (4, 1) = 0.6283375057113273e-11, (4, 2) = 0.8508276258437863e-10, (5, 1) = 0.9313240892518212e-11, (5, 2) = 0.850524526248668e-10, (6, 1) = 0.12788440808566913e-10, (6, 2) = 0.8495196380498024e-10, (7, 1) = 0.16287135608660245e-10, (7, 2) = 0.8471304348543666e-10, (8, 1) = 0.19699611956392223e-10, (8, 2) = 0.8425997605647669e-10, (9, 1) = 0.22970703993197084e-10, (9, 2) = 0.8350285806489384e-10, (10, 1) = 0.26048598673130164e-10, (10, 2) = 0.8236141880485556e-10, (11, 1) = 0.28889564796709118e-10, (11, 2) = 0.807680075517535e-10, (12, 1) = 0.3146419432537857e-10, (12, 2) = 0.7870861850220935e-10, (13, 1) = 0.3376845440237838e-10, (13, 2) = 0.76180914278436e-10, (14, 1) = 0.3581545341839668e-10, (14, 2) = 0.7320630957736423e-10, (15, 1) = 0.3762747046980736e-10, (15, 2) = 0.6982232414596841e-10, (16, 1) = 0.39230212673005174e-10, (16, 2) = 0.6604258823731611e-10, (17, 1) = 0.4064875043426625e-10, (17, 2) = 0.6189293843978883e-10, (18, 1) = 0.41906632200038427e-10, (18, 2) = 0.5738158028963009e-10, (19, 1) = 0.4302087761928263e-10, (19, 2) = 0.5252587897070069e-10, (20, 1) = 0.4400625271793831e-10, (20, 2) = 0.473336495149119e-10, (21, 1) = 0.4487303893267542e-10, (21, 2) = 0.4182437851641992e-10, (22, 1) = 0.45627455433617764e-10, (22, 2) = 0.3603061078162274e-10, (23, 1) = 0.46274326233327936e-10, (23, 2) = 0.3000955859504699e-10, (24, 1) = 0.4681459707278807e-10, (24, 2) = 0.23860447426484826e-10, (25, 1) = 0.4724842787651142e-10, (25, 2) = 0.1776023517981049e-10, (26, 1) = 0.4757427285465771e-10, (26, 2) = 0.12017595400831685e-10, (27, 1) = 0.47790227471357375e-10, (27, 2) = 0.7328480716784074e-11, (28, 1) = 0.4795031656612425e-10, (28, 2) = 0.39031837281309675e-11, (29, 1) = 0.4883478028979934e-10, (29, 2) = -0.5718940225545175e-10, (30, 1) = 0.3230575568675054e-10, (30, 2) = 0.85712698691126e-9, (31, 1) = 0.5985832736634328e-9, (31, 2) = -0.5676350604244536e-7, (32, 1) = -0.4105497749547362e-10, (32, 2) = 0.12576565171542372e-7, (33, 1) = 0.52828639118618086e-11, (33, 2) = -0.25901087299107644e-8, (34, 1) = -0.6792883439476795e-12, (34, 2) = 0.2799012115279449e-9, (35, 1) = 0.9967786151379876e-13, (35, 2) = -0.37228995825150445e-10, (36, 1) = .0, (36, 2) = -0.3165528815230616e-49}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[36] elif outpoint = "order" then return 10 elif outpoint = "error" then return HFloat(5.676350604244536e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [2, 36, [y(x), diff(y(x), x)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[36] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[36] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(2, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(36, 2, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(2, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(36, 2, X, Y, outpoint, yout, L, V) end if; [x = outpoint, seq('[y(x), diff(y(x), x)]'[i] = yout[i], i = 1 .. 2)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[36] elif outpoint = "order" then return 10 elif outpoint = "error" then return HFloat(5.676350604244536e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [2, 36, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[36] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[36] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(2, {(1) = .0, (2) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(36, 2, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(2, {(1) = 0., (2) = 0.}); `dsolve/numeric/hermite`(36, 2, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 2)] end proc, (2) = Array(1..3, {(1) = 18446884691877884342, (2) = 18446884691877887510, (3) = 18446884691877881918}), (3) = [x, y(x), diff(y(x), x)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x) else `y(x)` := pointto(data[2][2]); return ('`y(x)`')(x) end if end if; try res := solnproc(outpoint); res[2] catch: error  end try end proc

Here is what the solution y(x) looks like:

plot(tmp1(x), x=0..1, labels=[x,y]);

We find the inverse transformation proc (eta) options operator, arrow; x end proc:

isolate(eta=tan(Pi/2*x), x):
tmp2 := unapply(rhs(%), eta);

proc (eta) options operator, arrow; 2*arctan(eta)/Pi end proc

Convert the solution y(x) to theta(eta)

my_theta := tmp1@tmp2;

`@`(tmp1, tmp2)

Here is what the numerical solution looks like:

p2 := plot(my_theta(eta), eta=0..infinity, color=red, labels=[eta,theta]);

 

Comparison of the exact and numerical solutions

 

We plot the exact and numeric solutions together.

plots:-display([p1,p2]);

 

 

Download mw.mw

Yes, there is.                                                            

                        

Maple's setting are saved in the file $HOME/.maple/2018/maplerc in Linux.  Perhaps there are the equivalent files under other operating systems, but I wouldn't know that.

Anyway, in my maplerc I have:

Default Zoom=150

That sets a worksheet's default zoom.  I suppose the 150 could be changed to anything else if I wanted to.

plot([seq([n*(n+1),n], n=2..16)], style=point);

 

The solution obtained by Maple pdsolve (see vv's answer) corresponds to the initial condition u(x,t) = 2*A*cosh(c*x).  Here I will show what the true general solution looks like.  The underlying mathematical theory is explained in Wikipedia's page on Heat Equation.

restart;

We wish to obtain the general solution of

pde := diff(u(x,t),t) - K*diff(u(x,t),x,x);

diff(u(x, t), t)-K*(diff(diff(u(x, t), x), x))

on 0 < x and x < infinity, with the boundary condition "(&PartialD;u)/(&PartialD;x)(0,t)=0" for all t,

and the initial condition u(x, 0) = f(x) for 0 < x and x < infinity, where f

is a given function.

 

The trick for solving the problem is to extend f to the entire

real line as an even function, that is, f(x) = f(-x) for "-infinity<x<infinity,"

solve the original PDE on the entire real line, and then throw

away the part of the solution corresponding to the negative x.

The solution inherits the evenness of the initial condition, and

therefore it automatically satisfies the boundary condition at zero.

 

The fundamental solution of the heat equation (see Wikipedia) is:

G := (x,t) -> 1/sqrt(4*Pi*K*t)*exp(-x^2/(4*K*t));

proc (x, t) options operator, arrow; exp(-(1/4)*x^2/(K*t))/sqrt(4*Pi*K*t) end proc

The general solution of the PDE on the entire real line and
initial condition u(x, 0) = f(x) is obtained through a convolution:

u(x,t) = Int(G(x-y,t)*f(y), y=-infinity..infinity);

u(x, t) = Int((1/2)*exp(-(1/4)*(x-y)^2/(K*t))*f(y)/(Pi*K*t)^(1/2), y = -infinity .. infinity)

We split the integral into halves on the negative and positive axis,

apply the symmetry of f to simplify the result, and arrive at

sol := u(x,t) = Int( (G(x-y,t) + G(x+y,t))*f(y), y=0..infinity);

u(x, t) = Int(((1/2)*exp(-(1/4)*(x-y)^2/(K*t))/(Pi*K*t)^(1/2)+(1/2)*exp(-(1/4)*(x+y)^2/(K*t))/(Pi*K*t)^(1/2))*f(y), y = 0 .. infinity)

Let us verify that the expression obtained above satisfies the PDE:

simplify(eval(pde, sol));

0

and satisfies the boundary condition:

diff(sol,x):
eval(%, x=0):
simplify(%);

eval(diff(u(x, t), x), {x = 0}) = 0

 

 

With some effort, it is also possible to show that the solution obtained above satisfies the initial condition in the sense that the limit of u(x,t) as t goes to zero from the right is f(x).  I can do that by hand but I don't know how to do it in Maple.  Perhaps someone else can.

Download general-solution.mw

restart;
with(plots):
plt := inequal({sqrt((1/2)*x) < y and sqrt(Pi/(2*x)) < y and y < sqrt(x) and y < sqrt(Pi/x)}, x = 1 .. 3, y = 0 .. 2);
display([plt,
  textplot([
    [1.8,0.7, typeset('sqrt(x/2)')],
    [2.5,0.6, typeset('sqrt(Pi/x^2)')]
  ])
]);

 

In several places in your code you have used square brackets [ ] for grouping.  But square brackaets are not the same as parentheses ( ) in Maple or any other programming language.  Here is the fixed code:

restart;
ddesys := {diff(pred(t), t) = pred(t)*(prey(t)/(prey(t)+10)-2/3), diff(prey(t), t) = prey(t)*(2-(1/20)*prey(t-tau))-prey(t)*(pred(t)/(prey(t)+10))-10, pred(0) = 1, prey(0) = 1};
dsn := dsolve(eval(ddesys, tau = 0), numeric);
plots[odeplot](dsn, [[t, prey(t), color = red], [t, pred(t), color = blue]], t=0 .. 0.3, legend = [prey, pred], labels = [t, ""]);

In the last line I have replaced your plotting range of 0..300 with 0..0.3.  When you execute the code, you will see that the prey population drops down to zero and then becomes negative at time t=0.1.  This indicates a flaw in your model.  See how you can remedy that.

Your solution seems to be correct in general outline although I have not checked the details.  Part of the complication in what you have presented is due to the need to handle the internal forces within the rod.

Lagrangian mechanics (analytical mechanics) introduces a method for deriving a system's equations of motion without the need to deal with the internal forces, and that significantly simplifies the analysis.  Here I illustrate how to solve your problem through the Lagrangian formulation.

restart;

with(plots):

r__1 and r__2: position vectors of the two balls.
theta: the angle of the rod measured counterclockwise

from the downward vertical direction
a:  length of the rod

< x(t), y(t) >;
r[1] := unapply(%, t):
r[1](t) + a*< sin(theta(t)), -cos(theta(t))>;
r[2] := unapply(%, t):

Vector(2, {(1) = x(t), (2) = y(t)})

Vector[column](%id = 18446884489083941222)

Velocities of the balls

v[1] := diff~(r[1](t),t);
v[2] := diff~(r[2](t),t);

Vector(2, {(1) = diff(x(t), t), (2) = diff(y(t), t)})

Vector[column](%id = 18446884489083937366)

Kinetic energy of the system

T := 1/2 * m[1] * (v[1]^+ . v[1])
   + 1/2 * m[2] * (v[2]^+ . v[2]);

(1/2)*m[1]*((diff(x(t), t))^2+(diff(y(t), t))^2)+(1/2)*m[2]*((diff(x(t), t)+a*(diff(theta(t), t))*cos(theta(t)))^2+(diff(y(t), t)+a*(diff(theta(t), t))*sin(theta(t)))^2)

Potential energy of the system

V := m[1] * g * r[1](t)[2]
   + m[2] * g * r[2](t)[2];

g*m[1]*y(t)+g*m[2]*(y(t)-a*cos(theta(t)))

The Lagrangian

L := T - V;

(1/2)*m[1]*((diff(x(t), t))^2+(diff(y(t), t))^2)+(1/2)*m[2]*((diff(x(t), t)+a*(diff(theta(t), t))*cos(theta(t)))^2+(diff(y(t), t)+a*(diff(theta(t), t))*sin(theta(t)))^2)-g*m[1]*y(t)-g*m[2]*(y(t)-a*cos(theta(t)))

The equations of motion and integrals of motion via Euler-Lagrange:

tmp := VariationalCalculus:-EulerLagrange(L, t, [x(t),y(t),theta(t)]):

The integrals of motion that appear above as something=K__1 and something=K__2
are not of interest to us, so we get rid of them

EL := remove(type, tmp, 'equation'):

What remains are the equations of motion

de1 := simplify(EL[1]) = 0;

(-m[1]-m[2])*(diff(diff(x(t), t), t))+a*m[2]*((diff(theta(t), t))^2*sin(theta(t))-cos(theta(t))*(diff(diff(theta(t), t), t))) = 0

de2 := simplify(EL[2]) = 0;

-a*m[2]*((diff(diff(theta(t), t), t))*a+(diff(diff(x(t), t), t))*cos(theta(t))+sin(theta(t))*(diff(diff(y(t), t), t)+g)) = 0

de3 := simplify(EL[3]) = 0;

(-m[1]-m[2])*(diff(diff(y(t), t), t))-(diff(diff(theta(t), t), t))*sin(theta(t))*a*m[2]-cos(theta(t))*(diff(theta(t), t))^2*a*m[2]-g*(m[1]+m[2]) = 0

Pick parameters:

params := a=5, m[1]=1, m[2]=2, g=9.81:

Pick initial conditions:

ic := x(0)=0, y(0)=0, theta(0)=Pi/2,
      D(x)(0)=10, D(y)(0)=0, D(theta)(0)=2*Pi:

Here is the complete specification of the initial value problem:

sys := eval({de1,de2,de3,ic}, {params}):

Solve the initial value problem:

dsol := dsolve(sys, numeric, output=operator):

Find the time when ball #1 hits the ground:

eval(y(t),dsol):
tmax := fsolve(%, t=1e-5..infinity);

4.142121601

Plot the paths of the two balls.

Note: In plotting the blue path we need "params" to get the

value a of the bar's length.

paths := plot([
  eval([r[1](t)[1], r[1](t)[2], t=0..tmax], dsol),
  eval([r[2](t)[1], r[2](t)[2], t=0..tmax], {dsol[],params})
], color=["Pink","SkyBlue"]);

Produce a snapshot of the rod at time t

frame := proc(t)
  pointplot(eval(r[1](t), dsol),
      symbol=solidcircle, symbolsize=20, color=red);
  pointplot(eval(r[2](t), {dsol[], params}),
      symbol=solidcircle, symbolsize=20, color=blue);
  pointplot(eval([r[1](t),r[2](t)], {dsol[], params}),
      connect, color="Green");
  display([%%%,%%,%]);
end proc:

Produce animation:

seq(frame(t), t=0..tmax, 0.1):
display(%, insequence):
display([%, paths], scaling=constrained);

Download thrown-bola.mw

There is no expression for a "general solution" to your equation. Normally you would want to solve a PDE along with some boundary conditions which you have not specified.  If you are happy with just any particular solution, consider this one:

mysol := C0 + C1*r*cos(theta) + C2*r*sin(theta);

To verify that this is indeed a solution for any three constants C0, C1, and C2, do

simplify(subs(a(r,theta)=mysol, pde));

where "pde" stands for your PDE.

 

First 25 26 27 28 29 30 31 Last Page 27 of 53