<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Physics: Bead on a rotating hoop</title>
    <link>http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Tue, 09 Jun 2026 09:15:02 GMT</lastBuildDate>
    <pubDate>Tue, 09 Jun 2026 09:15:02 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Physics: Bead on a rotating hoop</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Physics: Bead on a rotating hoop</title>
      <link>http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop</link>
    </image>
    <item>
      <title>Square brackets</title>
      <link>http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop?ref=Feed:MaplePrimes:Physics: Bead on a rotating hoop:Comments#answer134018</link>
      <itunes:summary>&lt;p&gt;You must replace the square brackets [] used in 'de' by rounded ones (). &lt;/p&gt;
&lt;p&gt;And since you are using numerical solution of the problem you need to give Maple the values of g, R, and omega:&lt;/p&gt;
&lt;p&gt;g:=1: omega:=sqrt(2): R:=1:&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;You must replace the square brackets [] used in 'de' by rounded ones (). &lt;/p&gt;
&lt;p&gt;And since you are using numerical solution of the problem you need to give Maple the values of g, R, and omega:&lt;/p&gt;
&lt;p&gt;g:=1: omega:=sqrt(2): R:=1:&lt;/p&gt;</description>
      <guid>134018</guid>
      <pubDate>Thu, 10 May 2012 10:13:41 Z</pubDate>
      <itunes:author>Preben Alsholm</itunes:author>
      <author>Preben Alsholm</author>
    </item>
    <item>
      <title>Plot</title>
      <link>http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop?ref=Feed:MaplePrimes:Physics: Bead on a rotating hoop:Comments#comment134024</link>
      <itunes:summary>&lt;p&gt;Thank you very much I will try that in the morning. After I do that can I use odeplot to plot the solution theta x? Thank you&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thank you very much I will try that in the morning. After I do that can I use odeplot to plot the solution theta x? Thank you&amp;nbsp;&lt;/p&gt;</description>
      <guid>134024</guid>
      <pubDate>Thu, 10 May 2012 11:18:28 Z</pubDate>
      <itunes:author>koonduck</itunes:author>
      <author>koonduck</author>
    </item>
    <item>
      <title>@koonduck Yes, you can use odeplot like this
odeplot(dsol,</title>
      <link>http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop?ref=Feed:MaplePrimes:Physics: Bead on a rotating hoop:Comments#comment134030</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop#comment134024"&gt;@koonduck&lt;/a&gt; Yes, you can use odeplot like this&lt;/p&gt;
&lt;p&gt;odeplot(dsol,[x,theta(x)],0..40);&lt;/p&gt;
&lt;p&gt;# or you can use plot since in your worksheet you pulled out the theta-procedure in the line&lt;br&gt;dsol1 := subs(dsol, theta(x));&lt;br&gt;plot(dsol1,0..40);&lt;br&gt;&lt;br&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop#comment134024"&gt;@koonduck&lt;/a&gt; Yes, you can use odeplot like this&lt;/p&gt;
&lt;p&gt;odeplot(dsol,[x,theta(x)],0..40);&lt;/p&gt;
&lt;p&gt;# or you can use plot since in your worksheet you pulled out the theta-procedure in the line&lt;br&gt;dsol1 := subs(dsol, theta(x));&lt;br&gt;plot(dsol1,0..40);&lt;br&gt;&lt;br&gt;&lt;/p&gt;</description>
      <guid>134030</guid>
      <pubDate>Thu, 10 May 2012 15:22:37 Z</pubDate>
      <itunes:author>Preben Alsholm</itunes:author>
      <author>Preben Alsholm</author>
    </item>
    <item>
      <title>2nd Part</title>
      <link>http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop?ref=Feed:MaplePrimes:Physics: Bead on a rotating hoop:Comments#comment134038</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop#comment134030"&gt;@Preben Alsholm&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you very much that worked perfect, i have one last question though. I need to now plot an aproximation of this on the same graph. The aproximation is : &amp;theta;(x) = &amp;theta;&lt;sub&gt;o&lt;/sub&gt;+ cos(&amp;Omega;*x), where &amp;Omega;= sqrt(&amp;omega;&lt;sup&gt;2&lt;/sup&gt;-(g/&amp;omega;R)&lt;sup&gt;2&lt;/sup&gt;).&lt;/p&gt;
&lt;p&gt;My code so far is : &lt;br&gt; &lt;/p&gt;
&lt;form name="worksheet_form"&gt;
&lt;table style="width: 576px;" align="center"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/12201abb37af784297010c5612a1302a.gif" alt="de := {diff(theta(x), x, x) = (omega^2*cos(theta(x))-g/R)*sin(theta(x))}" width="328" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -20;" src="/view.aspx?sf=134038/436659/cd445ff0dc3ba3165a079b448ae8d960.gif" alt="{diff(diff(theta(x), x), x) = (omega^2*cos(theta(x))-g/R)*sin(theta(x))}" width="332" height="50"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(1)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -12;" src="/view.aspx?sf=134038/436659/ead6e172dc7177d15e89b1068b8fe65e.gif" alt="g := 1:" width="199" height="31"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/ac243bd48c725e26253906b54bbcbbdc.gif" alt="ic := {theta(0) = (1/3)*Pi+(1/180)*Pi, (D(theta))(0) = 0}" width="261" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/bbefafc3ce46b8b96c11e161b9a3dfed.gif" alt="{theta(0) = (61/180)*Pi, (D(theta))(0) = 0}" width="222" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(2)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=134038/436659/d1c3997deb4cf210912a70fa4011b19d.gif" alt="with(DEtools):" width="187" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -7;" src="/view.aspx?sf=134038/436659/b543615c0c69131abb5251ee748a756a.gif" alt="dsol := dsolve(`union`(de, ic), numeric, output = listprocedure)" width="347" height="24"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -52;" src="/view.aspx?sf=134038/436659/fbdbbda6db812386c36d4e535e7091b0.gif" alt="[x = proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 &amp;lt; nargs then error &amp;quot;invalid input: too many arguments&amp;quot; end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) 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( [( &amp;quot;complex&amp;quot; ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 19, [( 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)]), ( 5 ) = (Array(1..25, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = .18996434800573359, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .5, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = .0}, datatype = float[8], order = C_order)), ( 4 ) = (Array(1..49, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0}, datatype = integer[4])), ( 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)]), ( 6 ) = (Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 8 ) = ([Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = -0.2657161098296821e-1}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[4]), Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order)]), ( 15 ) = (&amp;quot;rkf45&amp;quot;), ( 14 ) = ([0, 0]), ( 13 ) = (), ( 12 ) = (), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 18 ) = ([]), ( 19 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 1.06465084371654}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _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, [&amp;quot;start&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = &amp;quot;left&amp;quot; then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = &amp;quot;right&amp;quot; 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 = &amp;quot;method&amp;quot; then return _dtbl[1][15] elif _xout = &amp;quot;storage&amp;quot; then return evalb(_dtbl[1][4][10] = 1) elif _xout = &amp;quot;leftdata&amp;quot; then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = &amp;quot;rightdata&amp;quot; then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = &amp;quot;enginedata&amp;quot; then return eval(_dtbl[1]) elif _xout = &amp;quot;enginereset&amp;quot; then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = &amp;quot;initial&amp;quot; then return procname(_y0[0]) elif _xout = &amp;quot;laxtol&amp;quot; then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = &amp;quot;numfun&amp;quot; then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = &amp;quot;parameters&amp;quot; then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;initial_and_parameters&amp;quot; then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;last&amp;quot; then if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error &amp;quot;no information is available on last computed point&amp;quot; else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = &amp;quot;function&amp;quot; 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 = &amp;quot;map&amp;quot; then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {&amp;quot;initial&amp;quot;, &amp;quot;parameters&amp;quot;, &amp;quot;initial_and_parameters&amp;quot;}) then _ini, _par := [], []; if lhs(_xin) = &amp;quot;initial&amp;quot; then _ini := rhs(_xin) elif lhs(_xin) = &amp;quot;parameters&amp;quot; then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) &amp;lt;&amp;gt; [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) &amp;lt; nops(_pars)+1 then error &amp;quot;insufficient data for specification of initial and parameters&amp;quot; else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par &amp;lt;&amp;gt; [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini &amp;lt;&amp;gt; [] 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] &amp;lt;&amp;gt; 1 then procname(&amp;quot;right&amp;quot;) := _y0[0]; procname(&amp;quot;left&amp;quot;) := _y0[0] end if; if _xout = &amp;quot;initial&amp;quot; then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = &amp;quot;parameters&amp;quot; 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 = &amp;quot;eventstop&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt;= _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 10 &amp;lt;= _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 = &amp;quot;eventstatus&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; 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 = &amp;quot;eventclear&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then error &amp;quot;no events to clear&amp;quot; end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt; _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] &amp;lt; 10 then error &amp;quot;no events to clear&amp;quot; elif _nv &amp;lt; _dtbl[_i][4][9]-10 then error &amp;quot;event error condition cannot be cleared&amp;quot; else _j := _dtbl[_i][4][9]-10; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error &amp;quot;retriggerable events cannot be cleared&amp;quot; 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 &amp;quot;range events cannot be cleared&amp;quot; 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(&amp;quot;left&amp;quot;)) catch:  end try else try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {&amp;quot;eventenable&amp;quot;, &amp;quot;eventdisable&amp;quot;}) then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if type(rhs(_xin), {('set')('posint'), ('list')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv &amp;lt; a end proc, _i) &amp;lt;&amp;gt; {} then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) = &amp;quot;eventdisable&amp;quot; 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 &amp;lt;= _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(&amp;quot;left&amp;quot;)) end if end if; if _j[2] then for _k to _nv+1 do if _k &amp;lt;= _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(&amp;quot;right&amp;quot;)) 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 &amp;lt;= procname(&amp;quot;right&amp;quot;) then try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if; if procname(&amp;quot;left&amp;quot;) &amp;lt;= _x0 then try procname(procname(&amp;quot;left&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = &amp;quot;eventfired&amp;quot; then if not type(rhs(_xin), 'list') then error &amp;quot;'eventfired' must be specified as a list&amp;quot; end if; if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then error &amp;quot;'direction' must be set prior to calling/setting 'eventfired'&amp;quot; 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 &amp;quot;'eventfired' entry is not valid: %1&amp;quot;, _k end if; if _src &amp;lt; 1 or round(_dtbl[1][3][1][_nv+1, 1]) &amp;lt; _src then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) &amp;lt;&amp;gt; 1 then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] &amp;lt;&amp;gt; 0. and _dtbl[1][3][1][_src, 2]-2. &amp;lt;&amp;gt; 0. then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; 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] &amp;lt; _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] &amp;lt; _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 &amp;quot;cannot set event code for a rate hysteresis event&amp;quot; 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) = &amp;quot;direction&amp;quot; then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error &amp;quot;'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)&amp;quot; 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 = &amp;quot;eventcount&amp;quot; then if _dtbl[1][3][1] = 0 or _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return &amp;quot;procname&amp;quot; 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 &amp;lt;= _xout, 3, 2); if _xin = &amp;quot;last&amp;quot; and 0 &amp;lt; _dtbl[_i][4][9] and _dtbl[_i][4][9] &amp;lt; 10 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 &amp;lt;&amp;gt; &amp;quot;last&amp;quot; then if 0 &amp;lt; 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 &amp;quot;parameters must be initialized before solution can be computed&amp;quot; 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 _src = 0 and 10 &amp;lt; _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src &amp;lt;&amp;gt; 0 or _dat[4][9] &amp;lt;= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val &amp;lt; _xout then Rounding := -infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further right of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further right of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further right of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further right of %1&amp;quot;, evalf[8](_val) end if elif _i = 2 and _xout &amp;lt; _val then Rounding := infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further left of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further left of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further left of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further left of %1&amp;quot;, evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _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..3, {(1) = 260736868, (2) = 260737012, (3) = 263716648}), (3) = [x, theta(x), diff(theta(x), x)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(x, [&amp;quot;start&amp;quot;, 'start', &amp;quot;method&amp;quot;, 'method', &amp;quot;left&amp;quot;, 'left', &amp;quot;right&amp;quot;, 'right', &amp;quot;leftdata&amp;quot;, &amp;quot;rightdata&amp;quot;, &amp;quot;enginedata&amp;quot;, &amp;quot;eventstop&amp;quot;, 'eventstop', &amp;quot;eventclear&amp;quot;, 'eventclear', &amp;quot;eventstatus&amp;quot;, 'eventstatus', &amp;quot;eventcount&amp;quot;, 'eventcount', &amp;quot;laxtol&amp;quot;, 'laxtol', &amp;quot;numfun&amp;quot;, 'numfun', NULL]) then _res := _solnproc(convert(x, 'string')); if 1 &amp;lt; nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res &amp;lt;&amp;gt; &amp;quot;procname&amp;quot; then return _res end if elif member(x, [&amp;quot;last&amp;quot;, 'last', &amp;quot;initial&amp;quot;, 'initial', NULL]) then _res := _solnproc(convert(x, 'string')); if type(_res, 'list') then return _res[1] else return NULL end if elif member(x, [&amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(x, 'string'); _res := _solnproc(_xout); if _xout = &amp;quot;parameters&amp;quot; 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), [&amp;quot;initial&amp;quot;, 'initial', &amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(lhs(x), 'string') = rhs(x); if lhs(_xout) = &amp;quot;initial&amp;quot; then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc(&amp;quot;initial&amp;quot; = [&amp;quot;single&amp;quot;, 1, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error &amp;quot;initial and/or parameter values must be specified in a list&amp;quot; elif lhs(_xout) = &amp;quot;initial_and_parameters&amp;quot; and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = [&amp;quot;single&amp;quot;, 1, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = &amp;quot;initial&amp;quot; then return _res[1] elif lhs(_xout) = &amp;quot;parameters&amp;quot; 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), [&amp;quot;eventdisable&amp;quot;, 'eventdisable', &amp;quot;eventenable&amp;quot;, 'eventenable', &amp;quot;eventfired&amp;quot;, 'eventfired', &amp;quot;direction&amp;quot;, 'direction', NULL]) then return _solnproc(convert(lhs(x), 'string') = rhs(x)) elif _xout = &amp;quot;solnprocedure&amp;quot; then return eval(_solnproc) elif _xout = &amp;quot;sysvars&amp;quot; then return _dat[3] end if; if procname &amp;lt;&amp;gt; unknown then return ('procname')(x) else _ndsol := `tools/gensym`(&amp;quot;x&amp;quot;); eval(FromInert(_Inert_FUNCTION(_Inert_NAME(&amp;quot;assign&amp;quot;), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][1])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(x)))) end if end if; try _res := _solnproc(_xout); _res[1] catch: error  end try end proc, theta(x) = proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 &amp;lt; nargs then error &amp;quot;invalid input: too many arguments&amp;quot; end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) 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( [( &amp;quot;complex&amp;quot; ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 19, [( 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)]), ( 5 ) = (Array(1..25, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = .18996434800573359, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .5, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = .0}, datatype = float[8], order = C_order)), ( 4 ) = (Array(1..49, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0}, datatype = integer[4])), ( 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)]), ( 6 ) = (Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 8 ) = ([Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = -0.2657161098296821e-1}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[4]), Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order)]), ( 15 ) = (&amp;quot;rkf45&amp;quot;), ( 14 ) = ([0, 0]), ( 13 ) = (), ( 12 ) = (), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 18 ) = ([]), ( 19 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 1.06465084371654}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _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, [&amp;quot;start&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = &amp;quot;left&amp;quot; then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = &amp;quot;right&amp;quot; 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 = &amp;quot;method&amp;quot; then return _dtbl[1][15] elif _xout = &amp;quot;storage&amp;quot; then return evalb(_dtbl[1][4][10] = 1) elif _xout = &amp;quot;leftdata&amp;quot; then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = &amp;quot;rightdata&amp;quot; then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = &amp;quot;enginedata&amp;quot; then return eval(_dtbl[1]) elif _xout = &amp;quot;enginereset&amp;quot; then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = &amp;quot;initial&amp;quot; then return procname(_y0[0]) elif _xout = &amp;quot;laxtol&amp;quot; then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = &amp;quot;numfun&amp;quot; then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = &amp;quot;parameters&amp;quot; then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;initial_and_parameters&amp;quot; then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;last&amp;quot; then if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error &amp;quot;no information is available on last computed point&amp;quot; else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = &amp;quot;function&amp;quot; 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 = &amp;quot;map&amp;quot; then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {&amp;quot;initial&amp;quot;, &amp;quot;parameters&amp;quot;, &amp;quot;initial_and_parameters&amp;quot;}) then _ini, _par := [], []; if lhs(_xin) = &amp;quot;initial&amp;quot; then _ini := rhs(_xin) elif lhs(_xin) = &amp;quot;parameters&amp;quot; then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) &amp;lt;&amp;gt; [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) &amp;lt; nops(_pars)+1 then error &amp;quot;insufficient data for specification of initial and parameters&amp;quot; else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par &amp;lt;&amp;gt; [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini &amp;lt;&amp;gt; [] 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] &amp;lt;&amp;gt; 1 then procname(&amp;quot;right&amp;quot;) := _y0[0]; procname(&amp;quot;left&amp;quot;) := _y0[0] end if; if _xout = &amp;quot;initial&amp;quot; then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = &amp;quot;parameters&amp;quot; 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 = &amp;quot;eventstop&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt;= _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 10 &amp;lt;= _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 = &amp;quot;eventstatus&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; 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 = &amp;quot;eventclear&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then error &amp;quot;no events to clear&amp;quot; end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt; _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] &amp;lt; 10 then error &amp;quot;no events to clear&amp;quot; elif _nv &amp;lt; _dtbl[_i][4][9]-10 then error &amp;quot;event error condition cannot be cleared&amp;quot; else _j := _dtbl[_i][4][9]-10; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error &amp;quot;retriggerable events cannot be cleared&amp;quot; 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 &amp;quot;range events cannot be cleared&amp;quot; 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(&amp;quot;left&amp;quot;)) catch:  end try else try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {&amp;quot;eventenable&amp;quot;, &amp;quot;eventdisable&amp;quot;}) then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if type(rhs(_xin), {('set')('posint'), ('list')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv &amp;lt; a end proc, _i) &amp;lt;&amp;gt; {} then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) = &amp;quot;eventdisable&amp;quot; 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 &amp;lt;= _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(&amp;quot;left&amp;quot;)) end if end if; if _j[2] then for _k to _nv+1 do if _k &amp;lt;= _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(&amp;quot;right&amp;quot;)) 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 &amp;lt;= procname(&amp;quot;right&amp;quot;) then try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if; if procname(&amp;quot;left&amp;quot;) &amp;lt;= _x0 then try procname(procname(&amp;quot;left&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = &amp;quot;eventfired&amp;quot; then if not type(rhs(_xin), 'list') then error &amp;quot;'eventfired' must be specified as a list&amp;quot; end if; if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then error &amp;quot;'direction' must be set prior to calling/setting 'eventfired'&amp;quot; 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 &amp;quot;'eventfired' entry is not valid: %1&amp;quot;, _k end if; if _src &amp;lt; 1 or round(_dtbl[1][3][1][_nv+1, 1]) &amp;lt; _src then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) &amp;lt;&amp;gt; 1 then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] &amp;lt;&amp;gt; 0. and _dtbl[1][3][1][_src, 2]-2. &amp;lt;&amp;gt; 0. then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; 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] &amp;lt; _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] &amp;lt; _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 &amp;quot;cannot set event code for a rate hysteresis event&amp;quot; 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) = &amp;quot;direction&amp;quot; then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error &amp;quot;'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)&amp;quot; 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 = &amp;quot;eventcount&amp;quot; then if _dtbl[1][3][1] = 0 or _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return &amp;quot;procname&amp;quot; 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 &amp;lt;= _xout, 3, 2); if _xin = &amp;quot;last&amp;quot; and 0 &amp;lt; _dtbl[_i][4][9] and _dtbl[_i][4][9] &amp;lt; 10 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 &amp;lt;&amp;gt; &amp;quot;last&amp;quot; then if 0 &amp;lt; 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 &amp;quot;parameters must be initialized before solution can be computed&amp;quot; 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 _src = 0 and 10 &amp;lt; _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src &amp;lt;&amp;gt; 0 or _dat[4][9] &amp;lt;= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val &amp;lt; _xout then Rounding := -infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further right of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further right of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further right of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further right of %1&amp;quot;, evalf[8](_val) end if elif _i = 2 and _xout &amp;lt; _val then Rounding := infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further left of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further left of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further left of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further left of %1&amp;quot;, evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _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..3, {(1) = 260736868, (2) = 260737012, (3) = 263716648}), (3) = [x, theta(x), diff(theta(x), x)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(x, [&amp;quot;start&amp;quot;, 'start', &amp;quot;method&amp;quot;, 'method', &amp;quot;left&amp;quot;, 'left', &amp;quot;right&amp;quot;, 'right', &amp;quot;leftdata&amp;quot;, &amp;quot;rightdata&amp;quot;, &amp;quot;enginedata&amp;quot;, &amp;quot;eventstop&amp;quot;, 'eventstop', &amp;quot;eventclear&amp;quot;, 'eventclear', &amp;quot;eventstatus&amp;quot;, 'eventstatus', &amp;quot;eventcount&amp;quot;, 'eventcount', &amp;quot;laxtol&amp;quot;, 'laxtol', &amp;quot;numfun&amp;quot;, 'numfun', NULL]) then _res := _solnproc(convert(x, 'string')); if 1 &amp;lt; nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res &amp;lt;&amp;gt; &amp;quot;procname&amp;quot; then return _res end if elif member(x, [&amp;quot;last&amp;quot;, 'last', &amp;quot;initial&amp;quot;, 'initial', NULL]) then _res := _solnproc(convert(x, 'string')); if type(_res, 'list') then return _res[2] else return NULL end if elif member(x, [&amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(x, 'string'); _res := _solnproc(_xout); if _xout = &amp;quot;parameters&amp;quot; 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), [&amp;quot;initial&amp;quot;, 'initial', &amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(lhs(x), 'string') = rhs(x); if lhs(_xout) = &amp;quot;initial&amp;quot; then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc(&amp;quot;initial&amp;quot; = [&amp;quot;single&amp;quot;, 2, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error &amp;quot;initial and/or parameter values must be specified in a list&amp;quot; elif lhs(_xout) = &amp;quot;initial_and_parameters&amp;quot; and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = [&amp;quot;single&amp;quot;, 2, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = &amp;quot;initial&amp;quot; then return _res[2] elif lhs(_xout) = &amp;quot;parameters&amp;quot; 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), [&amp;quot;eventdisable&amp;quot;, 'eventdisable', &amp;quot;eventenable&amp;quot;, 'eventenable', &amp;quot;eventfired&amp;quot;, 'eventfired', &amp;quot;direction&amp;quot;, 'direction', NULL]) then return _solnproc(convert(lhs(x), 'string') = rhs(x)) elif _xout = &amp;quot;solnprocedure&amp;quot; then return eval(_solnproc) elif _xout = &amp;quot;sysvars&amp;quot; then return _dat[3] end if; if procname &amp;lt;&amp;gt; unknown then return ('procname')(x) else _ndsol := `tools/gensym`(&amp;quot;theta(x)&amp;quot;); eval(FromInert(_Inert_FUNCTION(_Inert_NAME(&amp;quot;assign&amp;quot;), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][2])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(x)))) end if end if; try _res := _solnproc(_xout); _res[2] catch: error  end try end proc, diff(theta(x), x) = proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 &amp;lt; nargs then error &amp;quot;invalid input: too many arguments&amp;quot; end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) 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( [( &amp;quot;complex&amp;quot; ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 19, [( 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)]), ( 5 ) = (Array(1..25, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = .18996434800573359, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .5, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = .0}, datatype = float[8], order = C_order)), ( 4 ) = (Array(1..49, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0}, datatype = integer[4])), ( 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)]), ( 6 ) = (Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 8 ) = ([Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = -0.2657161098296821e-1}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[4]), Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order)]), ( 15 ) = (&amp;quot;rkf45&amp;quot;), ( 14 ) = ([0, 0]), ( 13 ) = (), ( 12 ) = (), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 18 ) = ([]), ( 19 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 1.06465084371654}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _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, [&amp;quot;start&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = &amp;quot;left&amp;quot; then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = &amp;quot;right&amp;quot; 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 = &amp;quot;method&amp;quot; then return _dtbl[1][15] elif _xout = &amp;quot;storage&amp;quot; then return evalb(_dtbl[1][4][10] = 1) elif _xout = &amp;quot;leftdata&amp;quot; then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = &amp;quot;rightdata&amp;quot; then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = &amp;quot;enginedata&amp;quot; then return eval(_dtbl[1]) elif _xout = &amp;quot;enginereset&amp;quot; then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = &amp;quot;initial&amp;quot; then return procname(_y0[0]) elif _xout = &amp;quot;laxtol&amp;quot; then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = &amp;quot;numfun&amp;quot; then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = &amp;quot;parameters&amp;quot; then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;initial_and_parameters&amp;quot; then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;last&amp;quot; then if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error &amp;quot;no information is available on last computed point&amp;quot; else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = &amp;quot;function&amp;quot; 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 = &amp;quot;map&amp;quot; then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {&amp;quot;initial&amp;quot;, &amp;quot;parameters&amp;quot;, &amp;quot;initial_and_parameters&amp;quot;}) then _ini, _par := [], []; if lhs(_xin) = &amp;quot;initial&amp;quot; then _ini := rhs(_xin) elif lhs(_xin) = &amp;quot;parameters&amp;quot; then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) &amp;lt;&amp;gt; [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) &amp;lt; nops(_pars)+1 then error &amp;quot;insufficient data for specification of initial and parameters&amp;quot; else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par &amp;lt;&amp;gt; [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini &amp;lt;&amp;gt; [] 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] &amp;lt;&amp;gt; 1 then procname(&amp;quot;right&amp;quot;) := _y0[0]; procname(&amp;quot;left&amp;quot;) := _y0[0] end if; if _xout = &amp;quot;initial&amp;quot; then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = &amp;quot;parameters&amp;quot; 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 = &amp;quot;eventstop&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt;= _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 10 &amp;lt;= _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 = &amp;quot;eventstatus&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; 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 = &amp;quot;eventclear&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then error &amp;quot;no events to clear&amp;quot; end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt; _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] &amp;lt; 10 then error &amp;quot;no events to clear&amp;quot; elif _nv &amp;lt; _dtbl[_i][4][9]-10 then error &amp;quot;event error condition cannot be cleared&amp;quot; else _j := _dtbl[_i][4][9]-10; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error &amp;quot;retriggerable events cannot be cleared&amp;quot; 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 &amp;quot;range events cannot be cleared&amp;quot; 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(&amp;quot;left&amp;quot;)) catch:  end try else try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {&amp;quot;eventenable&amp;quot;, &amp;quot;eventdisable&amp;quot;}) then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if type(rhs(_xin), {('set')('posint'), ('list')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv &amp;lt; a end proc, _i) &amp;lt;&amp;gt; {} then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) = &amp;quot;eventdisable&amp;quot; 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 &amp;lt;= _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(&amp;quot;left&amp;quot;)) end if end if; if _j[2] then for _k to _nv+1 do if _k &amp;lt;= _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(&amp;quot;right&amp;quot;)) 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 &amp;lt;= procname(&amp;quot;right&amp;quot;) then try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if; if procname(&amp;quot;left&amp;quot;) &amp;lt;= _x0 then try procname(procname(&amp;quot;left&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = &amp;quot;eventfired&amp;quot; then if not type(rhs(_xin), 'list') then error &amp;quot;'eventfired' must be specified as a list&amp;quot; end if; if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then error &amp;quot;'direction' must be set prior to calling/setting 'eventfired'&amp;quot; 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 &amp;quot;'eventfired' entry is not valid: %1&amp;quot;, _k end if; if _src &amp;lt; 1 or round(_dtbl[1][3][1][_nv+1, 1]) &amp;lt; _src then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) &amp;lt;&amp;gt; 1 then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] &amp;lt;&amp;gt; 0. and _dtbl[1][3][1][_src, 2]-2. &amp;lt;&amp;gt; 0. then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; 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] &amp;lt; _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] &amp;lt; _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 &amp;quot;cannot set event code for a rate hysteresis event&amp;quot; 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) = &amp;quot;direction&amp;quot; then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error &amp;quot;'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)&amp;quot; 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 = &amp;quot;eventcount&amp;quot; then if _dtbl[1][3][1] = 0 or _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return &amp;quot;procname&amp;quot; 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 &amp;lt;= _xout, 3, 2); if _xin = &amp;quot;last&amp;quot; and 0 &amp;lt; _dtbl[_i][4][9] and _dtbl[_i][4][9] &amp;lt; 10 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 &amp;lt;&amp;gt; &amp;quot;last&amp;quot; then if 0 &amp;lt; 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 &amp;quot;parameters must be initialized before solution can be computed&amp;quot; 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 _src = 0 and 10 &amp;lt; _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src &amp;lt;&amp;gt; 0 or _dat[4][9] &amp;lt;= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val &amp;lt; _xout then Rounding := -infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further right of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further right of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further right of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further right of %1&amp;quot;, evalf[8](_val) end if elif _i = 2 and _xout &amp;lt; _val then Rounding := infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further left of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further left of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further left of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further left of %1&amp;quot;, evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _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..3, {(1) = 260736868, (2) = 260737012, (3) = 263716648}), (3) = [x, theta(x), diff(theta(x), x)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(x, [&amp;quot;start&amp;quot;, 'start', &amp;quot;method&amp;quot;, 'method', &amp;quot;left&amp;quot;, 'left', &amp;quot;right&amp;quot;, 'right', &amp;quot;leftdata&amp;quot;, &amp;quot;rightdata&amp;quot;, &amp;quot;enginedata&amp;quot;, &amp;quot;eventstop&amp;quot;, 'eventstop', &amp;quot;eventclear&amp;quot;, 'eventclear', &amp;quot;eventstatus&amp;quot;, 'eventstatus', &amp;quot;eventcount&amp;quot;, 'eventcount', &amp;quot;laxtol&amp;quot;, 'laxtol', &amp;quot;numfun&amp;quot;, 'numfun', NULL]) then _res := _solnproc(convert(x, 'string')); if 1 &amp;lt; nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res &amp;lt;&amp;gt; &amp;quot;procname&amp;quot; then return _res end if elif member(x, [&amp;quot;last&amp;quot;, 'last', &amp;quot;initial&amp;quot;, 'initial', NULL]) then _res := _solnproc(convert(x, 'string')); if type(_res, 'list') then return _res[3] else return NULL end if elif member(x, [&amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(x, 'string'); _res := _solnproc(_xout); if _xout = &amp;quot;parameters&amp;quot; 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), [&amp;quot;initial&amp;quot;, 'initial', &amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(lhs(x), 'string') = rhs(x); if lhs(_xout) = &amp;quot;initial&amp;quot; then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc(&amp;quot;initial&amp;quot; = [&amp;quot;single&amp;quot;, 3, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error &amp;quot;initial and/or parameter values must be specified in a list&amp;quot; elif lhs(_xout) = &amp;quot;initial_and_parameters&amp;quot; and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = [&amp;quot;single&amp;quot;, 3, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = &amp;quot;initial&amp;quot; then return _res[3] elif lhs(_xout) = &amp;quot;parameters&amp;quot; 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), [&amp;quot;eventdisable&amp;quot;, 'eventdisable', &amp;quot;eventenable&amp;quot;, 'eventenable', &amp;quot;eventfired&amp;quot;, 'eventfired', &amp;quot;direction&amp;quot;, 'direction', NULL]) then return _solnproc(convert(lhs(x), 'string') = rhs(x)) elif _xout = &amp;quot;solnprocedure&amp;quot; then return eval(_solnproc) elif _xout = &amp;quot;sysvars&amp;quot; then return _dat[3] end if; if procname &amp;lt;&amp;gt; unknown then return ('procname')(x) else _ndsol := `tools/gensym`(&amp;quot;diff(theta(x),x)&amp;quot;); eval(FromInert(_Inert_FUNCTION(_Inert_NAME(&amp;quot;assign&amp;quot;), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][3])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(x)))) end if end if; try _res := _solnproc(_xout); _res[3] catch: error  end try end proc]" width="546" height="78" align="middle"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(3)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -7;" src="/view.aspx?sf=134038/436659/15fcd3561ac01e27b1405aad61bab8f8.gif" alt="dsol1 := subs(dsol, theta(x))" width="165" height="26"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -7;" src="/view.aspx?sf=134038/436659/d491225cae3edeb21be61dc1f54ee914.gif" alt="proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 &amp;lt; nargs then error &amp;quot;invalid input: too many arguments&amp;quot; end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) 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( [( &amp;quot;complex&amp;quot; ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 19, [( 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)]), ( 5 ) = (Array(1..25, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = .18996434800573359, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .5, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = .0}, datatype = float[8], order = C_order)), ( 4 ) = (Array(1..49, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0}, datatype = integer[4])), ( 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)]), ( 6 ) = (Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 8 ) = ([Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = -0.2657161098296821e-1}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[4]), Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order)]), ( 15 ) = (&amp;quot;rkf45&amp;quot;), ( 14 ) = ([0, 0]), ( 13 ) = (), ( 12 ) = (), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 18 ) = ([]), ( 19 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 1.06465084371654}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _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, [&amp;quot;start&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = &amp;quot;left&amp;quot; then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = &amp;quot;right&amp;quot; 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 = &amp;quot;method&amp;quot; then return _dtbl[1][15] elif _xout = &amp;quot;storage&amp;quot; then return evalb(_dtbl[1][4][10] = 1) elif _xout = &amp;quot;leftdata&amp;quot; then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = &amp;quot;rightdata&amp;quot; then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = &amp;quot;enginedata&amp;quot; then return eval(_dtbl[1]) elif _xout = &amp;quot;enginereset&amp;quot; then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = &amp;quot;initial&amp;quot; then return procname(_y0[0]) elif _xout = &amp;quot;laxtol&amp;quot; then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = &amp;quot;numfun&amp;quot; then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = &amp;quot;parameters&amp;quot; then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;initial_and_parameters&amp;quot; then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;last&amp;quot; then if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error &amp;quot;no information is available on last computed point&amp;quot; else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = &amp;quot;function&amp;quot; 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 = &amp;quot;map&amp;quot; then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {&amp;quot;initial&amp;quot;, &amp;quot;parameters&amp;quot;, &amp;quot;initial_and_parameters&amp;quot;}) then _ini, _par := [], []; if lhs(_xin) = &amp;quot;initial&amp;quot; then _ini := rhs(_xin) elif lhs(_xin) = &amp;quot;parameters&amp;quot; then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) &amp;lt;&amp;gt; [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) &amp;lt; nops(_pars)+1 then error &amp;quot;insufficient data for specification of initial and parameters&amp;quot; else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par &amp;lt;&amp;gt; [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini &amp;lt;&amp;gt; [] 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] &amp;lt;&amp;gt; 1 then procname(&amp;quot;right&amp;quot;) := _y0[0]; procname(&amp;quot;left&amp;quot;) := _y0[0] end if; if _xout = &amp;quot;initial&amp;quot; then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = &amp;quot;parameters&amp;quot; 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 = &amp;quot;eventstop&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt;= _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 10 &amp;lt;= _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 = &amp;quot;eventstatus&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; 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 = &amp;quot;eventclear&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then error &amp;quot;no events to clear&amp;quot; end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt; _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] &amp;lt; 10 then error &amp;quot;no events to clear&amp;quot; elif _nv &amp;lt; _dtbl[_i][4][9]-10 then error &amp;quot;event error condition cannot be cleared&amp;quot; else _j := _dtbl[_i][4][9]-10; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error &amp;quot;retriggerable events cannot be cleared&amp;quot; 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 &amp;quot;range events cannot be cleared&amp;quot; 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(&amp;quot;left&amp;quot;)) catch:  end try else try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {&amp;quot;eventenable&amp;quot;, &amp;quot;eventdisable&amp;quot;}) then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if type(rhs(_xin), {('set')('posint'), ('list')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv &amp;lt; a end proc, _i) &amp;lt;&amp;gt; {} then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) = &amp;quot;eventdisable&amp;quot; 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 &amp;lt;= _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(&amp;quot;left&amp;quot;)) end if end if; if _j[2] then for _k to _nv+1 do if _k &amp;lt;= _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(&amp;quot;right&amp;quot;)) 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 &amp;lt;= procname(&amp;quot;right&amp;quot;) then try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if; if procname(&amp;quot;left&amp;quot;) &amp;lt;= _x0 then try procname(procname(&amp;quot;left&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = &amp;quot;eventfired&amp;quot; then if not type(rhs(_xin), 'list') then error &amp;quot;'eventfired' must be specified as a list&amp;quot; end if; if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then error &amp;quot;'direction' must be set prior to calling/setting 'eventfired'&amp;quot; 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 &amp;quot;'eventfired' entry is not valid: %1&amp;quot;, _k end if; if _src &amp;lt; 1 or round(_dtbl[1][3][1][_nv+1, 1]) &amp;lt; _src then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) &amp;lt;&amp;gt; 1 then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] &amp;lt;&amp;gt; 0. and _dtbl[1][3][1][_src, 2]-2. &amp;lt;&amp;gt; 0. then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; 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] &amp;lt; _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] &amp;lt; _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 &amp;quot;cannot set event code for a rate hysteresis event&amp;quot; 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) = &amp;quot;direction&amp;quot; then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error &amp;quot;'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)&amp;quot; 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 = &amp;quot;eventcount&amp;quot; then if _dtbl[1][3][1] = 0 or _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return &amp;quot;procname&amp;quot; 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 &amp;lt;= _xout, 3, 2); if _xin = &amp;quot;last&amp;quot; and 0 &amp;lt; _dtbl[_i][4][9] and _dtbl[_i][4][9] &amp;lt; 10 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 &amp;lt;&amp;gt; &amp;quot;last&amp;quot; then if 0 &amp;lt; 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 &amp;quot;parameters must be initialized before solution can be computed&amp;quot; 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 _src = 0 and 10 &amp;lt; _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src &amp;lt;&amp;gt; 0 or _dat[4][9] &amp;lt;= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val &amp;lt; _xout then Rounding := -infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further right of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further right of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further right of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further right of %1&amp;quot;, evalf[8](_val) end if elif _i = 2 and _xout &amp;lt; _val then Rounding := infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further left of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further left of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further left of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further left of %1&amp;quot;, evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _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..3, {(1) = 260736868, (2) = 260737012, (3) = 263716648}), (3) = [x, theta(x), diff(theta(x), x)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(x, [&amp;quot;start&amp;quot;, 'start', &amp;quot;method&amp;quot;, 'method', &amp;quot;left&amp;quot;, 'left', &amp;quot;right&amp;quot;, 'right', &amp;quot;leftdata&amp;quot;, &amp;quot;rightdata&amp;quot;, &amp;quot;enginedata&amp;quot;, &amp;quot;eventstop&amp;quot;, 'eventstop', &amp;quot;eventclear&amp;quot;, 'eventclear', &amp;quot;eventstatus&amp;quot;, 'eventstatus', &amp;quot;eventcount&amp;quot;, 'eventcount', &amp;quot;laxtol&amp;quot;, 'laxtol', &amp;quot;numfun&amp;quot;, 'numfun', NULL]) then _res := _solnproc(convert(x, 'string')); if 1 &amp;lt; nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res &amp;lt;&amp;gt; &amp;quot;procname&amp;quot; then return _res end if elif member(x, [&amp;quot;last&amp;quot;, 'last', &amp;quot;initial&amp;quot;, 'initial', NULL]) then _res := _solnproc(convert(x, 'string')); if type(_res, 'list') then return _res[2] else return NULL end if elif member(x, [&amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(x, 'string'); _res := _solnproc(_xout); if _xout = &amp;quot;parameters&amp;quot; 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), [&amp;quot;initial&amp;quot;, 'initial', &amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(lhs(x), 'string') = rhs(x); if lhs(_xout) = &amp;quot;initial&amp;quot; then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc(&amp;quot;initial&amp;quot; = [&amp;quot;single&amp;quot;, 2, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error &amp;quot;initial and/or parameter values must be specified in a list&amp;quot; elif lhs(_xout) = &amp;quot;initial_and_parameters&amp;quot; and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = [&amp;quot;single&amp;quot;, 2, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = &amp;quot;initial&amp;quot; then return _res[2] elif lhs(_xout) = &amp;quot;parameters&amp;quot; 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), [&amp;quot;eventdisable&amp;quot;, 'eventdisable', &amp;quot;eventenable&amp;quot;, 'eventenable', &amp;quot;eventfired&amp;quot;, 'eventfired', &amp;quot;direction&amp;quot;, 'direction', NULL]) then return _solnproc(convert(lhs(x), 'string') = rhs(x)) elif _xout = &amp;quot;solnprocedure&amp;quot; then return eval(_solnproc) elif _xout = &amp;quot;sysvars&amp;quot; then return _dat[3] end if; if procname &amp;lt;&amp;gt; unknown then return ('procname')(x) else _ndsol := `tools/gensym`(&amp;quot;theta(x)&amp;quot;); eval(FromInert(_Inert_FUNCTION(_Inert_NAME(&amp;quot;assign&amp;quot;), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][2])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(x)))) end if end if; try _res := _solnproc(_xout); _res[2] catch: error  end try end proc" width="186" height="24"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(4)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=134038/436659/37f076aa8433c6a7a87b2390e8d39ad2.gif" alt="odeplot(dsol, [x, theta(x)], 0 .. 40);" width="218" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;a href="http://www.maplesoft.com/support/faqs/MapleNet/redirect.aspx?param=plot_java_14206"&gt;&lt;img style="border: none;" src="/view.aspx?sf=134038/436659/7539ab53b55d7bacaf9f05582a421b45.gif" alt="" width="400" height="400" align="middle"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -24;" src="/view.aspx?sf=134038/436659/d9f0c14bb92b8c35c30ef2ed09e2625b.gif" alt="Omega := sqrt(omega^2-(g/(omega*R))^2)" width="172" height="54"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/cfb240c520f6e5f78972fb0af603f3f4.gif" alt="(1/2)*6^(1/2)" width="81" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(5)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -34;" src="/view.aspx?sf=134038/436659/dd328482ef70f96feb2401818e00a907.gif" alt="theta[a] := proc (x) options operator, arrow; (1/3)*Pi+cos(Omega*x) end proc" width="576" height="60" align="middle"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/eb3eedf58cdf38c841746b24e1b1b7d3.gif" alt="proc (x) options operator, arrow; (1/3)*Pi+cos(Omega*x) end proc" width="165" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(6)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -12;" src="/view.aspx?sf=134038/436659/f28742c39f1e9a808dfe220294f3b6e0.gif" alt="plot(theta[a](x), 0 .. 0.2e-1)" width="120" height="31"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;a href="http://www.maplesoft.com/support/help/errors/view.aspx?path=Warning,%20unable%20to%20evaluate%20the%20function%20to%20numeric%20values%20in%20the%20region%3B%20see%20the%20plotting%20command's%20help%20page%20to%20ensure%20the%20calling%20sequence%20is%20correct"&gt;&lt;span style="color: #0000ff; font-size: 100%; font-family: Courier New,monospace; font-weight: normal; font-style: normal;"&gt;&lt;span style="text-decoration: underline;"&gt;Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;a href="http://www.maplesoft.com/support/faqs/MapleNet/redirect.aspx?param=plot_java_14206"&gt;&lt;img style="border: none;" src="/view.aspx?sf=134038/436659/db5fabecf9cf5b0f7c61f343fbb3650f.gif" alt="" width="400" height="400" align="middle"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=134038/436659/9ee648690d977c2d4506d8aac8dae4c4.gif" alt="``" width="11" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;input type="hidden" name="sequence" value="1"&gt; &lt;input type="hidden" name="cmd" value="none"&gt;&lt;/form&gt;
&lt;p&gt;Thank You!&lt;br&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=134038/436659/beadonhoop.mw"&gt;Download beadonhoop.mw&lt;/a&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop#comment134030"&gt;@Preben Alsholm&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you very much that worked perfect, i have one last question though. I need to now plot an aproximation of this on the same graph. The aproximation is : &amp;theta;(x) = &amp;theta;&lt;sub&gt;o&lt;/sub&gt;+ cos(&amp;Omega;*x), where &amp;Omega;= sqrt(&amp;omega;&lt;sup&gt;2&lt;/sup&gt;-(g/&amp;omega;R)&lt;sup&gt;2&lt;/sup&gt;).&lt;/p&gt;
&lt;p&gt;My code so far is : &lt;br&gt; &lt;/p&gt;
&lt;form name="worksheet_form"&gt;
&lt;table style="width: 576px;" align="center"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/12201abb37af784297010c5612a1302a.gif" alt="de := {diff(theta(x), x, x) = (omega^2*cos(theta(x))-g/R)*sin(theta(x))}" width="328" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -20;" src="/view.aspx?sf=134038/436659/cd445ff0dc3ba3165a079b448ae8d960.gif" alt="{diff(diff(theta(x), x), x) = (omega^2*cos(theta(x))-g/R)*sin(theta(x))}" width="332" height="50"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(1)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -12;" src="/view.aspx?sf=134038/436659/ead6e172dc7177d15e89b1068b8fe65e.gif" alt="g := 1:" width="199" height="31"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/ac243bd48c725e26253906b54bbcbbdc.gif" alt="ic := {theta(0) = (1/3)*Pi+(1/180)*Pi, (D(theta))(0) = 0}" width="261" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/bbefafc3ce46b8b96c11e161b9a3dfed.gif" alt="{theta(0) = (61/180)*Pi, (D(theta))(0) = 0}" width="222" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(2)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=134038/436659/d1c3997deb4cf210912a70fa4011b19d.gif" alt="with(DEtools):" width="187" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -7;" src="/view.aspx?sf=134038/436659/b543615c0c69131abb5251ee748a756a.gif" alt="dsol := dsolve(`union`(de, ic), numeric, output = listprocedure)" width="347" height="24"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -52;" src="/view.aspx?sf=134038/436659/fbdbbda6db812386c36d4e535e7091b0.gif" alt="[x = proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 &amp;lt; nargs then error &amp;quot;invalid input: too many arguments&amp;quot; end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) 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( [( &amp;quot;complex&amp;quot; ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 19, [( 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)]), ( 5 ) = (Array(1..25, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = .18996434800573359, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .5, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = .0}, datatype = float[8], order = C_order)), ( 4 ) = (Array(1..49, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0}, datatype = integer[4])), ( 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)]), ( 6 ) = (Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 8 ) = ([Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = -0.2657161098296821e-1}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[4]), Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order)]), ( 15 ) = (&amp;quot;rkf45&amp;quot;), ( 14 ) = ([0, 0]), ( 13 ) = (), ( 12 ) = (), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 18 ) = ([]), ( 19 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 1.06465084371654}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _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, [&amp;quot;start&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = &amp;quot;left&amp;quot; then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = &amp;quot;right&amp;quot; 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 = &amp;quot;method&amp;quot; then return _dtbl[1][15] elif _xout = &amp;quot;storage&amp;quot; then return evalb(_dtbl[1][4][10] = 1) elif _xout = &amp;quot;leftdata&amp;quot; then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = &amp;quot;rightdata&amp;quot; then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = &amp;quot;enginedata&amp;quot; then return eval(_dtbl[1]) elif _xout = &amp;quot;enginereset&amp;quot; then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = &amp;quot;initial&amp;quot; then return procname(_y0[0]) elif _xout = &amp;quot;laxtol&amp;quot; then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = &amp;quot;numfun&amp;quot; then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = &amp;quot;parameters&amp;quot; then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;initial_and_parameters&amp;quot; then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;last&amp;quot; then if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error &amp;quot;no information is available on last computed point&amp;quot; else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = &amp;quot;function&amp;quot; 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 = &amp;quot;map&amp;quot; then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {&amp;quot;initial&amp;quot;, &amp;quot;parameters&amp;quot;, &amp;quot;initial_and_parameters&amp;quot;}) then _ini, _par := [], []; if lhs(_xin) = &amp;quot;initial&amp;quot; then _ini := rhs(_xin) elif lhs(_xin) = &amp;quot;parameters&amp;quot; then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) &amp;lt;&amp;gt; [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) &amp;lt; nops(_pars)+1 then error &amp;quot;insufficient data for specification of initial and parameters&amp;quot; else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par &amp;lt;&amp;gt; [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini &amp;lt;&amp;gt; [] 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] &amp;lt;&amp;gt; 1 then procname(&amp;quot;right&amp;quot;) := _y0[0]; procname(&amp;quot;left&amp;quot;) := _y0[0] end if; if _xout = &amp;quot;initial&amp;quot; then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = &amp;quot;parameters&amp;quot; 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 = &amp;quot;eventstop&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt;= _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 10 &amp;lt;= _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 = &amp;quot;eventstatus&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; 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 = &amp;quot;eventclear&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then error &amp;quot;no events to clear&amp;quot; end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt; _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] &amp;lt; 10 then error &amp;quot;no events to clear&amp;quot; elif _nv &amp;lt; _dtbl[_i][4][9]-10 then error &amp;quot;event error condition cannot be cleared&amp;quot; else _j := _dtbl[_i][4][9]-10; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error &amp;quot;retriggerable events cannot be cleared&amp;quot; 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 &amp;quot;range events cannot be cleared&amp;quot; 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(&amp;quot;left&amp;quot;)) catch:  end try else try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {&amp;quot;eventenable&amp;quot;, &amp;quot;eventdisable&amp;quot;}) then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if type(rhs(_xin), {('set')('posint'), ('list')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv &amp;lt; a end proc, _i) &amp;lt;&amp;gt; {} then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) = &amp;quot;eventdisable&amp;quot; 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 &amp;lt;= _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(&amp;quot;left&amp;quot;)) end if end if; if _j[2] then for _k to _nv+1 do if _k &amp;lt;= _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(&amp;quot;right&amp;quot;)) 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 &amp;lt;= procname(&amp;quot;right&amp;quot;) then try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if; if procname(&amp;quot;left&amp;quot;) &amp;lt;= _x0 then try procname(procname(&amp;quot;left&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = &amp;quot;eventfired&amp;quot; then if not type(rhs(_xin), 'list') then error &amp;quot;'eventfired' must be specified as a list&amp;quot; end if; if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then error &amp;quot;'direction' must be set prior to calling/setting 'eventfired'&amp;quot; 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 &amp;quot;'eventfired' entry is not valid: %1&amp;quot;, _k end if; if _src &amp;lt; 1 or round(_dtbl[1][3][1][_nv+1, 1]) &amp;lt; _src then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) &amp;lt;&amp;gt; 1 then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] &amp;lt;&amp;gt; 0. and _dtbl[1][3][1][_src, 2]-2. &amp;lt;&amp;gt; 0. then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; 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] &amp;lt; _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] &amp;lt; _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 &amp;quot;cannot set event code for a rate hysteresis event&amp;quot; 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) = &amp;quot;direction&amp;quot; then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error &amp;quot;'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)&amp;quot; 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 = &amp;quot;eventcount&amp;quot; then if _dtbl[1][3][1] = 0 or _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return &amp;quot;procname&amp;quot; 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 &amp;lt;= _xout, 3, 2); if _xin = &amp;quot;last&amp;quot; and 0 &amp;lt; _dtbl[_i][4][9] and _dtbl[_i][4][9] &amp;lt; 10 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 &amp;lt;&amp;gt; &amp;quot;last&amp;quot; then if 0 &amp;lt; 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 &amp;quot;parameters must be initialized before solution can be computed&amp;quot; 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 _src = 0 and 10 &amp;lt; _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src &amp;lt;&amp;gt; 0 or _dat[4][9] &amp;lt;= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val &amp;lt; _xout then Rounding := -infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further right of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further right of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further right of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further right of %1&amp;quot;, evalf[8](_val) end if elif _i = 2 and _xout &amp;lt; _val then Rounding := infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further left of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further left of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further left of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further left of %1&amp;quot;, evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _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..3, {(1) = 260736868, (2) = 260737012, (3) = 263716648}), (3) = [x, theta(x), diff(theta(x), x)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(x, [&amp;quot;start&amp;quot;, 'start', &amp;quot;method&amp;quot;, 'method', &amp;quot;left&amp;quot;, 'left', &amp;quot;right&amp;quot;, 'right', &amp;quot;leftdata&amp;quot;, &amp;quot;rightdata&amp;quot;, &amp;quot;enginedata&amp;quot;, &amp;quot;eventstop&amp;quot;, 'eventstop', &amp;quot;eventclear&amp;quot;, 'eventclear', &amp;quot;eventstatus&amp;quot;, 'eventstatus', &amp;quot;eventcount&amp;quot;, 'eventcount', &amp;quot;laxtol&amp;quot;, 'laxtol', &amp;quot;numfun&amp;quot;, 'numfun', NULL]) then _res := _solnproc(convert(x, 'string')); if 1 &amp;lt; nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res &amp;lt;&amp;gt; &amp;quot;procname&amp;quot; then return _res end if elif member(x, [&amp;quot;last&amp;quot;, 'last', &amp;quot;initial&amp;quot;, 'initial', NULL]) then _res := _solnproc(convert(x, 'string')); if type(_res, 'list') then return _res[1] else return NULL end if elif member(x, [&amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(x, 'string'); _res := _solnproc(_xout); if _xout = &amp;quot;parameters&amp;quot; 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), [&amp;quot;initial&amp;quot;, 'initial', &amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(lhs(x), 'string') = rhs(x); if lhs(_xout) = &amp;quot;initial&amp;quot; then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc(&amp;quot;initial&amp;quot; = [&amp;quot;single&amp;quot;, 1, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error &amp;quot;initial and/or parameter values must be specified in a list&amp;quot; elif lhs(_xout) = &amp;quot;initial_and_parameters&amp;quot; and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = [&amp;quot;single&amp;quot;, 1, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = &amp;quot;initial&amp;quot; then return _res[1] elif lhs(_xout) = &amp;quot;parameters&amp;quot; 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), [&amp;quot;eventdisable&amp;quot;, 'eventdisable', &amp;quot;eventenable&amp;quot;, 'eventenable', &amp;quot;eventfired&amp;quot;, 'eventfired', &amp;quot;direction&amp;quot;, 'direction', NULL]) then return _solnproc(convert(lhs(x), 'string') = rhs(x)) elif _xout = &amp;quot;solnprocedure&amp;quot; then return eval(_solnproc) elif _xout = &amp;quot;sysvars&amp;quot; then return _dat[3] end if; if procname &amp;lt;&amp;gt; unknown then return ('procname')(x) else _ndsol := `tools/gensym`(&amp;quot;x&amp;quot;); eval(FromInert(_Inert_FUNCTION(_Inert_NAME(&amp;quot;assign&amp;quot;), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][1])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(x)))) end if end if; try _res := _solnproc(_xout); _res[1] catch: error  end try end proc, theta(x) = proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 &amp;lt; nargs then error &amp;quot;invalid input: too many arguments&amp;quot; end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) 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( [( &amp;quot;complex&amp;quot; ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 19, [( 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)]), ( 5 ) = (Array(1..25, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = .18996434800573359, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .5, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = .0}, datatype = float[8], order = C_order)), ( 4 ) = (Array(1..49, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0}, datatype = integer[4])), ( 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)]), ( 6 ) = (Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 8 ) = ([Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = -0.2657161098296821e-1}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[4]), Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order)]), ( 15 ) = (&amp;quot;rkf45&amp;quot;), ( 14 ) = ([0, 0]), ( 13 ) = (), ( 12 ) = (), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 18 ) = ([]), ( 19 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 1.06465084371654}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _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, [&amp;quot;start&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = &amp;quot;left&amp;quot; then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = &amp;quot;right&amp;quot; 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 = &amp;quot;method&amp;quot; then return _dtbl[1][15] elif _xout = &amp;quot;storage&amp;quot; then return evalb(_dtbl[1][4][10] = 1) elif _xout = &amp;quot;leftdata&amp;quot; then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = &amp;quot;rightdata&amp;quot; then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = &amp;quot;enginedata&amp;quot; then return eval(_dtbl[1]) elif _xout = &amp;quot;enginereset&amp;quot; then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = &amp;quot;initial&amp;quot; then return procname(_y0[0]) elif _xout = &amp;quot;laxtol&amp;quot; then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = &amp;quot;numfun&amp;quot; then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = &amp;quot;parameters&amp;quot; then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;initial_and_parameters&amp;quot; then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;last&amp;quot; then if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error &amp;quot;no information is available on last computed point&amp;quot; else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = &amp;quot;function&amp;quot; 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 = &amp;quot;map&amp;quot; then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {&amp;quot;initial&amp;quot;, &amp;quot;parameters&amp;quot;, &amp;quot;initial_and_parameters&amp;quot;}) then _ini, _par := [], []; if lhs(_xin) = &amp;quot;initial&amp;quot; then _ini := rhs(_xin) elif lhs(_xin) = &amp;quot;parameters&amp;quot; then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) &amp;lt;&amp;gt; [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) &amp;lt; nops(_pars)+1 then error &amp;quot;insufficient data for specification of initial and parameters&amp;quot; else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par &amp;lt;&amp;gt; [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini &amp;lt;&amp;gt; [] 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] &amp;lt;&amp;gt; 1 then procname(&amp;quot;right&amp;quot;) := _y0[0]; procname(&amp;quot;left&amp;quot;) := _y0[0] end if; if _xout = &amp;quot;initial&amp;quot; then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = &amp;quot;parameters&amp;quot; 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 = &amp;quot;eventstop&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt;= _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 10 &amp;lt;= _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 = &amp;quot;eventstatus&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; 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 = &amp;quot;eventclear&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then error &amp;quot;no events to clear&amp;quot; end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt; _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] &amp;lt; 10 then error &amp;quot;no events to clear&amp;quot; elif _nv &amp;lt; _dtbl[_i][4][9]-10 then error &amp;quot;event error condition cannot be cleared&amp;quot; else _j := _dtbl[_i][4][9]-10; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error &amp;quot;retriggerable events cannot be cleared&amp;quot; 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 &amp;quot;range events cannot be cleared&amp;quot; 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(&amp;quot;left&amp;quot;)) catch:  end try else try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {&amp;quot;eventenable&amp;quot;, &amp;quot;eventdisable&amp;quot;}) then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if type(rhs(_xin), {('set')('posint'), ('list')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv &amp;lt; a end proc, _i) &amp;lt;&amp;gt; {} then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) = &amp;quot;eventdisable&amp;quot; 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 &amp;lt;= _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(&amp;quot;left&amp;quot;)) end if end if; if _j[2] then for _k to _nv+1 do if _k &amp;lt;= _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(&amp;quot;right&amp;quot;)) 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 &amp;lt;= procname(&amp;quot;right&amp;quot;) then try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if; if procname(&amp;quot;left&amp;quot;) &amp;lt;= _x0 then try procname(procname(&amp;quot;left&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = &amp;quot;eventfired&amp;quot; then if not type(rhs(_xin), 'list') then error &amp;quot;'eventfired' must be specified as a list&amp;quot; end if; if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then error &amp;quot;'direction' must be set prior to calling/setting 'eventfired'&amp;quot; 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 &amp;quot;'eventfired' entry is not valid: %1&amp;quot;, _k end if; if _src &amp;lt; 1 or round(_dtbl[1][3][1][_nv+1, 1]) &amp;lt; _src then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) &amp;lt;&amp;gt; 1 then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] &amp;lt;&amp;gt; 0. and _dtbl[1][3][1][_src, 2]-2. &amp;lt;&amp;gt; 0. then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; 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] &amp;lt; _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] &amp;lt; _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 &amp;quot;cannot set event code for a rate hysteresis event&amp;quot; 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) = &amp;quot;direction&amp;quot; then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error &amp;quot;'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)&amp;quot; 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 = &amp;quot;eventcount&amp;quot; then if _dtbl[1][3][1] = 0 or _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return &amp;quot;procname&amp;quot; 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 &amp;lt;= _xout, 3, 2); if _xin = &amp;quot;last&amp;quot; and 0 &amp;lt; _dtbl[_i][4][9] and _dtbl[_i][4][9] &amp;lt; 10 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 &amp;lt;&amp;gt; &amp;quot;last&amp;quot; then if 0 &amp;lt; 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 &amp;quot;parameters must be initialized before solution can be computed&amp;quot; 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 _src = 0 and 10 &amp;lt; _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src &amp;lt;&amp;gt; 0 or _dat[4][9] &amp;lt;= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val &amp;lt; _xout then Rounding := -infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further right of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further right of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further right of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further right of %1&amp;quot;, evalf[8](_val) end if elif _i = 2 and _xout &amp;lt; _val then Rounding := infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further left of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further left of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further left of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further left of %1&amp;quot;, evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _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..3, {(1) = 260736868, (2) = 260737012, (3) = 263716648}), (3) = [x, theta(x), diff(theta(x), x)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(x, [&amp;quot;start&amp;quot;, 'start', &amp;quot;method&amp;quot;, 'method', &amp;quot;left&amp;quot;, 'left', &amp;quot;right&amp;quot;, 'right', &amp;quot;leftdata&amp;quot;, &amp;quot;rightdata&amp;quot;, &amp;quot;enginedata&amp;quot;, &amp;quot;eventstop&amp;quot;, 'eventstop', &amp;quot;eventclear&amp;quot;, 'eventclear', &amp;quot;eventstatus&amp;quot;, 'eventstatus', &amp;quot;eventcount&amp;quot;, 'eventcount', &amp;quot;laxtol&amp;quot;, 'laxtol', &amp;quot;numfun&amp;quot;, 'numfun', NULL]) then _res := _solnproc(convert(x, 'string')); if 1 &amp;lt; nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res &amp;lt;&amp;gt; &amp;quot;procname&amp;quot; then return _res end if elif member(x, [&amp;quot;last&amp;quot;, 'last', &amp;quot;initial&amp;quot;, 'initial', NULL]) then _res := _solnproc(convert(x, 'string')); if type(_res, 'list') then return _res[2] else return NULL end if elif member(x, [&amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(x, 'string'); _res := _solnproc(_xout); if _xout = &amp;quot;parameters&amp;quot; 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), [&amp;quot;initial&amp;quot;, 'initial', &amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(lhs(x), 'string') = rhs(x); if lhs(_xout) = &amp;quot;initial&amp;quot; then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc(&amp;quot;initial&amp;quot; = [&amp;quot;single&amp;quot;, 2, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error &amp;quot;initial and/or parameter values must be specified in a list&amp;quot; elif lhs(_xout) = &amp;quot;initial_and_parameters&amp;quot; and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = [&amp;quot;single&amp;quot;, 2, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = &amp;quot;initial&amp;quot; then return _res[2] elif lhs(_xout) = &amp;quot;parameters&amp;quot; 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), [&amp;quot;eventdisable&amp;quot;, 'eventdisable', &amp;quot;eventenable&amp;quot;, 'eventenable', &amp;quot;eventfired&amp;quot;, 'eventfired', &amp;quot;direction&amp;quot;, 'direction', NULL]) then return _solnproc(convert(lhs(x), 'string') = rhs(x)) elif _xout = &amp;quot;solnprocedure&amp;quot; then return eval(_solnproc) elif _xout = &amp;quot;sysvars&amp;quot; then return _dat[3] end if; if procname &amp;lt;&amp;gt; unknown then return ('procname')(x) else _ndsol := `tools/gensym`(&amp;quot;theta(x)&amp;quot;); eval(FromInert(_Inert_FUNCTION(_Inert_NAME(&amp;quot;assign&amp;quot;), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][2])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(x)))) end if end if; try _res := _solnproc(_xout); _res[2] catch: error  end try end proc, diff(theta(x), x) = proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 &amp;lt; nargs then error &amp;quot;invalid input: too many arguments&amp;quot; end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) 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( [( &amp;quot;complex&amp;quot; ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 19, [( 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)]), ( 5 ) = (Array(1..25, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = .18996434800573359, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .5, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = .0}, datatype = float[8], order = C_order)), ( 4 ) = (Array(1..49, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0}, datatype = integer[4])), ( 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)]), ( 6 ) = (Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 8 ) = ([Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = -0.2657161098296821e-1}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[4]), Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order)]), ( 15 ) = (&amp;quot;rkf45&amp;quot;), ( 14 ) = ([0, 0]), ( 13 ) = (), ( 12 ) = (), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 18 ) = ([]), ( 19 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 1.06465084371654}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _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, [&amp;quot;start&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = &amp;quot;left&amp;quot; then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = &amp;quot;right&amp;quot; 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 = &amp;quot;method&amp;quot; then return _dtbl[1][15] elif _xout = &amp;quot;storage&amp;quot; then return evalb(_dtbl[1][4][10] = 1) elif _xout = &amp;quot;leftdata&amp;quot; then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = &amp;quot;rightdata&amp;quot; then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = &amp;quot;enginedata&amp;quot; then return eval(_dtbl[1]) elif _xout = &amp;quot;enginereset&amp;quot; then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = &amp;quot;initial&amp;quot; then return procname(_y0[0]) elif _xout = &amp;quot;laxtol&amp;quot; then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = &amp;quot;numfun&amp;quot; then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = &amp;quot;parameters&amp;quot; then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;initial_and_parameters&amp;quot; then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;last&amp;quot; then if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error &amp;quot;no information is available on last computed point&amp;quot; else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = &amp;quot;function&amp;quot; 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 = &amp;quot;map&amp;quot; then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {&amp;quot;initial&amp;quot;, &amp;quot;parameters&amp;quot;, &amp;quot;initial_and_parameters&amp;quot;}) then _ini, _par := [], []; if lhs(_xin) = &amp;quot;initial&amp;quot; then _ini := rhs(_xin) elif lhs(_xin) = &amp;quot;parameters&amp;quot; then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) &amp;lt;&amp;gt; [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) &amp;lt; nops(_pars)+1 then error &amp;quot;insufficient data for specification of initial and parameters&amp;quot; else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par &amp;lt;&amp;gt; [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini &amp;lt;&amp;gt; [] 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] &amp;lt;&amp;gt; 1 then procname(&amp;quot;right&amp;quot;) := _y0[0]; procname(&amp;quot;left&amp;quot;) := _y0[0] end if; if _xout = &amp;quot;initial&amp;quot; then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = &amp;quot;parameters&amp;quot; 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 = &amp;quot;eventstop&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt;= _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 10 &amp;lt;= _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 = &amp;quot;eventstatus&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; 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 = &amp;quot;eventclear&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then error &amp;quot;no events to clear&amp;quot; end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt; _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] &amp;lt; 10 then error &amp;quot;no events to clear&amp;quot; elif _nv &amp;lt; _dtbl[_i][4][9]-10 then error &amp;quot;event error condition cannot be cleared&amp;quot; else _j := _dtbl[_i][4][9]-10; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error &amp;quot;retriggerable events cannot be cleared&amp;quot; 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 &amp;quot;range events cannot be cleared&amp;quot; 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(&amp;quot;left&amp;quot;)) catch:  end try else try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {&amp;quot;eventenable&amp;quot;, &amp;quot;eventdisable&amp;quot;}) then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if type(rhs(_xin), {('set')('posint'), ('list')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv &amp;lt; a end proc, _i) &amp;lt;&amp;gt; {} then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) = &amp;quot;eventdisable&amp;quot; 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 &amp;lt;= _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(&amp;quot;left&amp;quot;)) end if end if; if _j[2] then for _k to _nv+1 do if _k &amp;lt;= _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(&amp;quot;right&amp;quot;)) 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 &amp;lt;= procname(&amp;quot;right&amp;quot;) then try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if; if procname(&amp;quot;left&amp;quot;) &amp;lt;= _x0 then try procname(procname(&amp;quot;left&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = &amp;quot;eventfired&amp;quot; then if not type(rhs(_xin), 'list') then error &amp;quot;'eventfired' must be specified as a list&amp;quot; end if; if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then error &amp;quot;'direction' must be set prior to calling/setting 'eventfired'&amp;quot; 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 &amp;quot;'eventfired' entry is not valid: %1&amp;quot;, _k end if; if _src &amp;lt; 1 or round(_dtbl[1][3][1][_nv+1, 1]) &amp;lt; _src then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) &amp;lt;&amp;gt; 1 then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] &amp;lt;&amp;gt; 0. and _dtbl[1][3][1][_src, 2]-2. &amp;lt;&amp;gt; 0. then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; 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] &amp;lt; _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] &amp;lt; _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 &amp;quot;cannot set event code for a rate hysteresis event&amp;quot; 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) = &amp;quot;direction&amp;quot; then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error &amp;quot;'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)&amp;quot; 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 = &amp;quot;eventcount&amp;quot; then if _dtbl[1][3][1] = 0 or _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return &amp;quot;procname&amp;quot; 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 &amp;lt;= _xout, 3, 2); if _xin = &amp;quot;last&amp;quot; and 0 &amp;lt; _dtbl[_i][4][9] and _dtbl[_i][4][9] &amp;lt; 10 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 &amp;lt;&amp;gt; &amp;quot;last&amp;quot; then if 0 &amp;lt; 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 &amp;quot;parameters must be initialized before solution can be computed&amp;quot; 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 _src = 0 and 10 &amp;lt; _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src &amp;lt;&amp;gt; 0 or _dat[4][9] &amp;lt;= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val &amp;lt; _xout then Rounding := -infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further right of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further right of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further right of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further right of %1&amp;quot;, evalf[8](_val) end if elif _i = 2 and _xout &amp;lt; _val then Rounding := infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further left of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further left of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further left of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further left of %1&amp;quot;, evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _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..3, {(1) = 260736868, (2) = 260737012, (3) = 263716648}), (3) = [x, theta(x), diff(theta(x), x)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(x, [&amp;quot;start&amp;quot;, 'start', &amp;quot;method&amp;quot;, 'method', &amp;quot;left&amp;quot;, 'left', &amp;quot;right&amp;quot;, 'right', &amp;quot;leftdata&amp;quot;, &amp;quot;rightdata&amp;quot;, &amp;quot;enginedata&amp;quot;, &amp;quot;eventstop&amp;quot;, 'eventstop', &amp;quot;eventclear&amp;quot;, 'eventclear', &amp;quot;eventstatus&amp;quot;, 'eventstatus', &amp;quot;eventcount&amp;quot;, 'eventcount', &amp;quot;laxtol&amp;quot;, 'laxtol', &amp;quot;numfun&amp;quot;, 'numfun', NULL]) then _res := _solnproc(convert(x, 'string')); if 1 &amp;lt; nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res &amp;lt;&amp;gt; &amp;quot;procname&amp;quot; then return _res end if elif member(x, [&amp;quot;last&amp;quot;, 'last', &amp;quot;initial&amp;quot;, 'initial', NULL]) then _res := _solnproc(convert(x, 'string')); if type(_res, 'list') then return _res[3] else return NULL end if elif member(x, [&amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(x, 'string'); _res := _solnproc(_xout); if _xout = &amp;quot;parameters&amp;quot; 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), [&amp;quot;initial&amp;quot;, 'initial', &amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(lhs(x), 'string') = rhs(x); if lhs(_xout) = &amp;quot;initial&amp;quot; then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc(&amp;quot;initial&amp;quot; = [&amp;quot;single&amp;quot;, 3, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error &amp;quot;initial and/or parameter values must be specified in a list&amp;quot; elif lhs(_xout) = &amp;quot;initial_and_parameters&amp;quot; and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = [&amp;quot;single&amp;quot;, 3, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = &amp;quot;initial&amp;quot; then return _res[3] elif lhs(_xout) = &amp;quot;parameters&amp;quot; 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), [&amp;quot;eventdisable&amp;quot;, 'eventdisable', &amp;quot;eventenable&amp;quot;, 'eventenable', &amp;quot;eventfired&amp;quot;, 'eventfired', &amp;quot;direction&amp;quot;, 'direction', NULL]) then return _solnproc(convert(lhs(x), 'string') = rhs(x)) elif _xout = &amp;quot;solnprocedure&amp;quot; then return eval(_solnproc) elif _xout = &amp;quot;sysvars&amp;quot; then return _dat[3] end if; if procname &amp;lt;&amp;gt; unknown then return ('procname')(x) else _ndsol := `tools/gensym`(&amp;quot;diff(theta(x),x)&amp;quot;); eval(FromInert(_Inert_FUNCTION(_Inert_NAME(&amp;quot;assign&amp;quot;), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][3])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(x)))) end if end if; try _res := _solnproc(_xout); _res[3] catch: error  end try end proc]" width="546" height="78" align="middle"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(3)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -7;" src="/view.aspx?sf=134038/436659/15fcd3561ac01e27b1405aad61bab8f8.gif" alt="dsol1 := subs(dsol, theta(x))" width="165" height="26"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -7;" src="/view.aspx?sf=134038/436659/d491225cae3edeb21be61dc1f54ee914.gif" alt="proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 &amp;lt; nargs then error &amp;quot;invalid input: too many arguments&amp;quot; end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) 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( [( &amp;quot;complex&amp;quot; ) = false ] ) _xout := _xin; _pars := []; _dtbl := array( 1 .. 4, [( 1 ) = (array( 1 .. 19, [( 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)]), ( 5 ) = (Array(1..25, {(1) = .0, (2) = 0.10e-5, (3) = .0, (4) = 0.500001e-14, (5) = .0, (6) = .18996434800573359, (7) = .0, (8) = 0.10e-5, (9) = .0, (10) = .0, (11) = .0, (12) = .0, (13) = 1.0, (14) = .0, (15) = .5, (16) = .0, (17) = 1.0, (18) = 1.0, (19) = .0, (20) = .0, (21) = 1.0, (22) = 1.0, (23) = .0, (24) = .0, (25) = .0}, datatype = float[8], order = C_order)), ( 4 ) = (Array(1..49, {(1) = 2, (2) = 2, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 1, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 1, (19) = 30000, (20) = 0, (21) = 0, (22) = 1, (23) = 4, (24) = 0, (25) = 1, (26) = 15, (27) = 1, (28) = 0, (29) = 1, (30) = 3, (31) = 3, (32) = 0, (33) = 1, (34) = 0, (35) = 0, (36) = 0, (37) = 0, (38) = 0, (39) = 0, (40) = 0, (41) = 0, (42) = 0, (43) = 1, (44) = 0, (45) = 0, (46) = 0, (47) = 0, (48) = 0, (49) = 0}, datatype = integer[4])), ( 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)]), ( 6 ) = (Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order)), ( 10 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 11 ) = (Array(1..6, 0..2, {(1, 1) = .0, (1, 2) = .0, (2, 0) = .0, (2, 1) = .0, (2, 2) = .0, (3, 0) = .0, (3, 1) = .0, (3, 2) = .0, (4, 0) = .0, (4, 1) = .0, (4, 2) = .0, (5, 0) = .0, (5, 1) = .0, (5, 2) = .0, (6, 0) = .0, (6, 1) = .0, (6, 2) = .0}, datatype = float[8], order = C_order)), ( 8 ) = ([Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = -0.2657161098296821e-1}, datatype = float[8], order = C_order)]), ( 9 ) = ([Array(1..2, {(1) = .1, (2) = .1}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0}, datatype = float[8], order = C_order), Array(1..2, 1..6, {(1, 1) = .0, (1, 2) = .0, (1, 3) = .0, (1, 4) = .0, (1, 5) = .0, (1, 6) = .0, (2, 1) = .0, (2, 2) = .0, (2, 3) = .0, (2, 4) = .0, (2, 5) = .0, (2, 6) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = 0, (2) = 0}, datatype = integer[4]), Array(1..2, {(1) = 1.06465084371654, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order), Array(1..2, {(1) = .0, (2) = .0}, datatype = float[8], order = C_order)]), ( 15 ) = (&amp;quot;rkf45&amp;quot;), ( 14 ) = ([0, 0]), ( 13 ) = (), ( 12 ) = (), ( 16 ) = ([0, 0, 0, []]), ( 17 ) = ([proc (N, X, Y, YP) option `[Y[1] = theta(x), Y[2] = diff(theta(x),x)]`; YP[2] := (2*cos(Y[1])-1)*sin(Y[1]); YP[1] := Y[2]; 0 end proc, -1, 0, 0, 0, 0]), ( 18 ) = ([]), ( 19 ) = (0)  ] ))  ] ); _y0 := Array(0..2, {(1) = 0., (2) = 1.06465084371654}); _vmap := array( 1 .. 2, [( 1 ) = (1), ( 2 ) = (2)  ] ); _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, [&amp;quot;start&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;]) then if _Env_smart_dsolve_numeric = true or _dtbl[1][4][10] = 1 then if _xout = &amp;quot;left&amp;quot; then if type(_dtbl[2], 'table') then return _dtbl[2][5][1] end if elif _xout = &amp;quot;right&amp;quot; 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 = &amp;quot;method&amp;quot; then return _dtbl[1][15] elif _xout = &amp;quot;storage&amp;quot; then return evalb(_dtbl[1][4][10] = 1) elif _xout = &amp;quot;leftdata&amp;quot; then if not type(_dtbl[2], 'array') then return NULL else return eval(_dtbl[2]) end if elif _xout = &amp;quot;rightdata&amp;quot; then if not type(_dtbl[3], 'array') then return NULL else return eval(_dtbl[3]) end if elif _xout = &amp;quot;enginedata&amp;quot; then return eval(_dtbl[1]) elif _xout = &amp;quot;enginereset&amp;quot; then _dtbl[2] := evaln(_dtbl[2]); _dtbl[3] := evaln(_dtbl[3]); return NULL elif _xout = &amp;quot;initial&amp;quot; then return procname(_y0[0]) elif _xout = &amp;quot;laxtol&amp;quot; then return _dtbl[`if`(member(_dtbl[4], {2, 3}), _dtbl[4], 1)][5][18] elif _xout = &amp;quot;numfun&amp;quot; then return `if`(member(_dtbl[4], {2, 3}), _dtbl[_dtbl[4]][4][18], 0) elif _xout = &amp;quot;parameters&amp;quot; then return [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;initial_and_parameters&amp;quot; then return procname(_y0[0]), [seq(_y0[_n+_i], _i = 1 .. nops(_pars))] elif _xout = &amp;quot;last&amp;quot; then if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 or _x0-_dtbl[_dtbl[4]][5][1] = 0. then error &amp;quot;no information is available on last computed point&amp;quot; else _xout := _dtbl[_dtbl[4]][5][1] end if elif _xout = &amp;quot;function&amp;quot; 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 = &amp;quot;map&amp;quot; then return copy(_vmap) elif type(_xin, `=`) and type(rhs(_xin), 'list') and member(lhs(_xin), {&amp;quot;initial&amp;quot;, &amp;quot;parameters&amp;quot;, &amp;quot;initial_and_parameters&amp;quot;}) then _ini, _par := [], []; if lhs(_xin) = &amp;quot;initial&amp;quot; then _ini := rhs(_xin) elif lhs(_xin) = &amp;quot;parameters&amp;quot; then _par := rhs(_xin) elif select(type, rhs(_xin), `=`) &amp;lt;&amp;gt; [] then _par, _ini := selectremove(type, rhs(_xin), `=`) elif nops(rhs(_xin)) &amp;lt; nops(_pars)+1 then error &amp;quot;insufficient data for specification of initial and parameters&amp;quot; else _par := rhs(_xin)[-nops(_pars) .. -1]; _ini := rhs(_xin)[1 .. -nops(_pars)-1] end if; _xout := lhs(_xout); if _par &amp;lt;&amp;gt; [] then `dsolve/numeric/process_parameters`(_n, _pars, _par, _y0) end if; if _ini &amp;lt;&amp;gt; [] 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] &amp;lt;&amp;gt; 1 then procname(&amp;quot;right&amp;quot;) := _y0[0]; procname(&amp;quot;left&amp;quot;) := _y0[0] end if; if _xout = &amp;quot;initial&amp;quot; then return [_y0[0], seq(_y0[_vmap[_i]], _i = 1 .. _n-_ne)] elif _xout = &amp;quot;parameters&amp;quot; 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 = &amp;quot;eventstop&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then return 0 end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt;= _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 10 &amp;lt;= _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 = &amp;quot;eventstatus&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; 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 = &amp;quot;eventclear&amp;quot; then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; _i := _dtbl[4]; if _i &amp;lt;&amp;gt; 2 and _i &amp;lt;&amp;gt; 3 then error &amp;quot;no events to clear&amp;quot; end if; if _dtbl[_i][4][10] = 1 and assigned(_dtbl[5-_i]) and _dtbl[_i][4][9] &amp;lt; 10 and 10 &amp;lt; _dtbl[5-_i][4][9] then _dtbl[4] := 5-_i; _i := 5-_i end if; if _dtbl[_i][4][9] &amp;lt; 10 then error &amp;quot;no events to clear&amp;quot; elif _nv &amp;lt; _dtbl[_i][4][9]-10 then error &amp;quot;event error condition cannot be cleared&amp;quot; else _j := _dtbl[_i][4][9]-10; if irem(round(_dtbl[_i][3][1][_j, 4]), 2) = 1 then error &amp;quot;retriggerable events cannot be cleared&amp;quot; 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 &amp;quot;range events cannot be cleared&amp;quot; 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(&amp;quot;left&amp;quot;)) catch:  end try else try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and member(lhs(_xin), {&amp;quot;eventenable&amp;quot;, &amp;quot;eventdisable&amp;quot;}) then if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if type(rhs(_xin), {('set')('posint'), ('list')('posint')}) then _i := {op(rhs(_xin))} elif type(rhs(_xin), 'posint') then _i := {rhs(_xin)} else error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, round(_dtbl[1][3][1][_nv+1, 1]) end if; if select(proc (a) options operator, arrow; _nv &amp;lt; a end proc, _i) &amp;lt;&amp;gt; {} then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) = &amp;quot;eventdisable&amp;quot; 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 &amp;lt;= _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(&amp;quot;left&amp;quot;)) end if end if; if _j[2] then for _k to _nv+1 do if _k &amp;lt;= _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(&amp;quot;right&amp;quot;)) 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 &amp;lt;= procname(&amp;quot;right&amp;quot;) then try procname(procname(&amp;quot;right&amp;quot;)) catch:  end try end if; if procname(&amp;quot;left&amp;quot;) &amp;lt;= _x0 then try procname(procname(&amp;quot;left&amp;quot;)) catch:  end try end if end if end if; return  elif type(_xin, `=`) and lhs(_xin) = &amp;quot;eventfired&amp;quot; then if not type(rhs(_xin), 'list') then error &amp;quot;'eventfired' must be specified as a list&amp;quot; end if; if _nv = 0 then error &amp;quot;this solution has no events&amp;quot; end if; if _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then error &amp;quot;'direction' must be set prior to calling/setting 'eventfired'&amp;quot; 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 &amp;quot;'eventfired' entry is not valid: %1&amp;quot;, _k end if; if _src &amp;lt; 1 or round(_dtbl[1][3][1][_nv+1, 1]) &amp;lt; _src then error &amp;quot;event identifiers must be integers in the range 1..%1&amp;quot;, 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) &amp;lt;&amp;gt; 1 then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; end if; _src := _src[1]; if _dtbl[1][3][1][_src, 2] &amp;lt;&amp;gt; 0. and _dtbl[1][3][1][_src, 2]-2. &amp;lt;&amp;gt; 0. then error &amp;quot;'eventfired' can only be set/queried for root-finding events and time/interval events&amp;quot; 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] &amp;lt; _dtbl[2][3][4][_src, 1] or _i = 3 and _dtbl[3][3][4][_src, 2] &amp;lt; _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 &amp;quot;cannot set event code for a rate hysteresis event&amp;quot; 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) = &amp;quot;direction&amp;quot; then if not member(rhs(_xin), {-1, 1, ':-left', ':-right'}) then error &amp;quot;'direction' must be specified as either '1' or 'right' (positive) or '-1' or 'left' (negative)&amp;quot; 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 = &amp;quot;eventcount&amp;quot; then if _dtbl[1][3][1] = 0 or _dtbl[4] &amp;lt;&amp;gt; 2 and _dtbl[4] &amp;lt;&amp;gt; 3 then return 0 else return round(_dtbl[_dtbl[4]][3][1][_nv+1, 12]) end if else return &amp;quot;procname&amp;quot; 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 &amp;lt;= _xout, 3, 2); if _xin = &amp;quot;last&amp;quot; and 0 &amp;lt; _dtbl[_i][4][9] and _dtbl[_i][4][9] &amp;lt; 10 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 &amp;lt; _nv then for _j to _nv+1 do if _j &amp;lt;= _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 &amp;lt;&amp;gt; &amp;quot;last&amp;quot; then if 0 &amp;lt; 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 &amp;quot;parameters must be initialized before solution can be computed&amp;quot; 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 _src = 0 and 10 &amp;lt; _dat[4][9] then _val := _dat[3][1][_nv+1, 8] else _val := _dat[11][_dat[4][20], 0] end if; if _src &amp;lt;&amp;gt; 0 or _dat[4][9] &amp;lt;= 0 then _dtbl[1][5][1] := _xout else _dtbl[1][5][1] := _val end if; if _i = 3 and _val &amp;lt; _xout then Rounding := -infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further right of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further right of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further right of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further right of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further right of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further right of %1&amp;quot;, evalf[8](_val) end if elif _i = 2 and _xout &amp;lt; _val then Rounding := infinity; if _dat[4][9] = 1 then error &amp;quot;cannot evaluate the solution further left of %1, probably a singularity&amp;quot;, evalf[8](_val) elif _dat[4][9] = 2 then error &amp;quot;cannot evaluate the solution further left of %1, maxfun limit exceeded (see &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=dsolve,maxfun' target='_new'&gt;?dsolve,maxfun&lt;/a&gt; for details)&amp;quot;, evalf[8](_val) elif _dat[4][9] = 3 then if _dat[4][25] = 3 then error &amp;quot;cannot evaluate the solution past the initial point, problem may be initially singular or improperly set up&amp;quot; else error &amp;quot;cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up&amp;quot; end if elif _dat[4][9] = 4 then error &amp;quot;cannot evaluate the solution further left of %1, accuracy goal cannot be achieved with specified 'minstep'&amp;quot;, evalf[8](_val) elif _dat[4][9] = 5 then error &amp;quot;cannot evaluate the solution further left of %1, too many step failures, tolerances may be too loose for problem&amp;quot;, evalf[8](_val) elif 10 &amp;lt; _dat[4][9] then if _dat[4][9]-10 = _nv+1 then error &amp;quot;constraint projection failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+2 then error &amp;quot;index-1 and derivative evaluation failure on event at t=%1&amp;quot;, evalf[8](_val) elif _dat[4][9]-10 = _nv+3 then error &amp;quot;maximum number of event iterations reached (%1) at t=%2&amp;quot;, round(_dat[3][1][_nv+1, 3]), evalf[8](_val) else if _Env_dsolve_nowarnstop &amp;lt;&amp;gt; true then `dsolve/numeric/warning`(StringTools:-FormatMessage(&amp;quot;cannot evaluate the solution further left of %1, event #%2 triggered a halt&amp;quot;, evalf[8](_val), round(_dat[3][1][_dat[4][9]-10, 1]))) end if; Rounding := 'nearest'; _xout := _val end if else error &amp;quot;cannot evaluate the solution further left of %1&amp;quot;, evalf[8](_val) end if end if; if _EnvInFsolve = true then _dig := _dat[4][26]; _dat[4][26] := _EnvDSNumericSaveDigits; _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..3, {(1) = 260736868, (2) = 260737012, (3) = 263716648}), (3) = [x, theta(x), diff(theta(x), x)], (4) = []}); _solnproc := _dat[1]; _pars := map(rhs, _dat[4]); if not type(_xout, 'numeric') then if member(x, [&amp;quot;start&amp;quot;, 'start', &amp;quot;method&amp;quot;, 'method', &amp;quot;left&amp;quot;, 'left', &amp;quot;right&amp;quot;, 'right', &amp;quot;leftdata&amp;quot;, &amp;quot;rightdata&amp;quot;, &amp;quot;enginedata&amp;quot;, &amp;quot;eventstop&amp;quot;, 'eventstop', &amp;quot;eventclear&amp;quot;, 'eventclear', &amp;quot;eventstatus&amp;quot;, 'eventstatus', &amp;quot;eventcount&amp;quot;, 'eventcount', &amp;quot;laxtol&amp;quot;, 'laxtol', &amp;quot;numfun&amp;quot;, 'numfun', NULL]) then _res := _solnproc(convert(x, 'string')); if 1 &amp;lt; nops([_res]) then return _res elif type(_res, 'array') then return eval(_res, 1) elif _res &amp;lt;&amp;gt; &amp;quot;procname&amp;quot; then return _res end if elif member(x, [&amp;quot;last&amp;quot;, 'last', &amp;quot;initial&amp;quot;, 'initial', NULL]) then _res := _solnproc(convert(x, 'string')); if type(_res, 'list') then return _res[2] else return NULL end if elif member(x, [&amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(x, 'string'); _res := _solnproc(_xout); if _xout = &amp;quot;parameters&amp;quot; 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), [&amp;quot;initial&amp;quot;, 'initial', &amp;quot;parameters&amp;quot;, 'parameters', &amp;quot;initial_and_parameters&amp;quot;, 'initial_and_parameters', NULL]) then _xout := convert(lhs(x), 'string') = rhs(x); if lhs(_xout) = &amp;quot;initial&amp;quot; then if type(rhs(_xout), 'list') then _res := _solnproc(_xout) else _res := _solnproc(&amp;quot;initial&amp;quot; = [&amp;quot;single&amp;quot;, 2, rhs(_xout)]) end if elif not type(rhs(_xout), 'list') then error &amp;quot;initial and/or parameter values must be specified in a list&amp;quot; elif lhs(_xout) = &amp;quot;initial_and_parameters&amp;quot; and nops(rhs(_xout)) = nops(_pars)+1 then _res := _solnproc(lhs(_xout) = [&amp;quot;single&amp;quot;, 2, op(rhs(_xout))]) else _res := _solnproc(_xout) end if; if lhs(_xout) = &amp;quot;initial&amp;quot; then return _res[2] elif lhs(_xout) = &amp;quot;parameters&amp;quot; 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), [&amp;quot;eventdisable&amp;quot;, 'eventdisable', &amp;quot;eventenable&amp;quot;, 'eventenable', &amp;quot;eventfired&amp;quot;, 'eventfired', &amp;quot;direction&amp;quot;, 'direction', NULL]) then return _solnproc(convert(lhs(x), 'string') = rhs(x)) elif _xout = &amp;quot;solnprocedure&amp;quot; then return eval(_solnproc) elif _xout = &amp;quot;sysvars&amp;quot; then return _dat[3] end if; if procname &amp;lt;&amp;gt; unknown then return ('procname')(x) else _ndsol := `tools/gensym`(&amp;quot;theta(x)&amp;quot;); eval(FromInert(_Inert_FUNCTION(_Inert_NAME(&amp;quot;assign&amp;quot;), _Inert_EXPSEQ(ToInert(_ndsol), _Inert_VERBATIM(pointto(_dat[2][2])))))); return FromInert(_Inert_FUNCTION(ToInert(_ndsol), _Inert_EXPSEQ(ToInert(x)))) end if end if; try _res := _solnproc(_xout); _res[2] catch: error  end try end proc" width="186" height="24"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(4)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=134038/436659/37f076aa8433c6a7a87b2390e8d39ad2.gif" alt="odeplot(dsol, [x, theta(x)], 0 .. 40);" width="218" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;a href="http://www.maplesoft.com/support/faqs/MapleNet/redirect.aspx?param=plot_java_14206"&gt;&lt;img style="border: none;" src="/view.aspx?sf=134038/436659/7539ab53b55d7bacaf9f05582a421b45.gif" alt="" width="400" height="400" align="middle"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -24;" src="/view.aspx?sf=134038/436659/d9f0c14bb92b8c35c30ef2ed09e2625b.gif" alt="Omega := sqrt(omega^2-(g/(omega*R))^2)" width="172" height="54"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/cfb240c520f6e5f78972fb0af603f3f4.gif" alt="(1/2)*6^(1/2)" width="81" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(5)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -34;" src="/view.aspx?sf=134038/436659/dd328482ef70f96feb2401818e00a907.gif" alt="theta[a] := proc (x) options operator, arrow; (1/3)*Pi+cos(Omega*x) end proc" width="576" height="60" align="middle"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;img style="vertical-align: -16;" src="/view.aspx?sf=134038/436659/eb3eedf58cdf38c841746b24e1b1b7d3.gif" alt="proc (x) options operator, arrow; (1/3)*Pi+cos(Omega*x) end proc" width="165" height="42"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;(6)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -12;" src="/view.aspx?sf=134038/436659/f28742c39f1e9a808dfe220294f3b6e0.gif" alt="plot(theta[a](x), 0 .. 0.2e-1)" width="120" height="31"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;a href="http://www.maplesoft.com/support/help/errors/view.aspx?path=Warning,%20unable%20to%20evaluate%20the%20function%20to%20numeric%20values%20in%20the%20region%3B%20see%20the%20plotting%20command's%20help%20page%20to%20ensure%20the%20calling%20sequence%20is%20correct"&gt;&lt;span style="color: #0000ff; font-size: 100%; font-family: Courier New,monospace; font-weight: normal; font-style: normal;"&gt;&lt;span style="text-decoration: underline;"&gt;Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="center"&gt;&lt;a href="http://www.maplesoft.com/support/faqs/MapleNet/redirect.aspx?param=plot_java_14206"&gt;&lt;img style="border: none;" src="/view.aspx?sf=134038/436659/db5fabecf9cf5b0f7c61f343fbb3650f.gif" alt="" width="400" height="400" align="middle"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="color: #000000; font-family: Times, serif; font-weight: bold; font-style: normal;" align="right"&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style="margin-left: 0px; margin-right: 0px;"&gt;
&lt;tbody&gt;
&lt;tr valign="baseline"&gt;
&lt;td&gt;&lt;span style="color: #ff0000; font-size: 100%; font-family: Courier New,monospace; font-weight: bold; font-style: normal;"&gt; &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style="margin: 0 0 0 0; padding-top: 0px; padding-bottom: 0px;" align="left"&gt;&lt;img style="vertical-align: -6;" src="/view.aspx?sf=134038/436659/9ee648690d977c2d4506d8aac8dae4c4.gif" alt="``" width="11" height="23"&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;input type="hidden" name="sequence" value="1"&gt; &lt;input type="hidden" name="cmd" value="none"&gt;&lt;/form&gt;
&lt;p&gt;Thank You!&lt;br&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=134038/436659/beadonhoop.mw"&gt;Download beadonhoop.mw&lt;/a&gt;&lt;/p&gt;</description>
      <guid>134038</guid>
      <pubDate>Thu, 10 May 2012 20:55:24 Z</pubDate>
      <itunes:author>koonduck</itunes:author>
      <author>koonduck</author>
    </item>
    <item>
      <title>Plotting syntax</title>
      <link>http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop?ref=Feed:MaplePrimes:Physics: Bead on a rotating hoop:Comments#comment134069</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop#comment134038"&gt;@koonduck&lt;/a&gt; Save the plots and use 'display'.&lt;/p&gt;
&lt;p&gt;odeplot(dsol, [x, theta(x)], 0 .. 40); &lt;br&gt;p1 := %;&lt;br&gt;Omega := sqrt(omega^2-(g/(omega*R))^2);&lt;br&gt;#It is inadvisable to use theta and theta[a] in the same worksheet, so I have used another name:&lt;br&gt;thetaapprox := x-&amp;gt;(1/3)*Pi+cos(Omega*x);&lt;br&gt;#You need an 'x' in the plotting interval when plotting an expression containing x. When plotting a procedure, however, you should only have the interval itself.&lt;br&gt;plot(thetaapprox(x), x = 0 .. 40, color = blue); p2:=%:&lt;br&gt;display(p1, p2);&lt;/p&gt;
&lt;p&gt;If thetaapprox is supposed to be an approximation then certainly the amplitude is way off!&lt;br&gt;&lt;br&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop#comment134038"&gt;@koonduck&lt;/a&gt; Save the plots and use 'display'.&lt;/p&gt;
&lt;p&gt;odeplot(dsol, [x, theta(x)], 0 .. 40); &lt;br&gt;p1 := %;&lt;br&gt;Omega := sqrt(omega^2-(g/(omega*R))^2);&lt;br&gt;#It is inadvisable to use theta and theta[a] in the same worksheet, so I have used another name:&lt;br&gt;thetaapprox := x-&amp;gt;(1/3)*Pi+cos(Omega*x);&lt;br&gt;#You need an 'x' in the plotting interval when plotting an expression containing x. When plotting a procedure, however, you should only have the interval itself.&lt;br&gt;plot(thetaapprox(x), x = 0 .. 40, color = blue); p2:=%:&lt;br&gt;display(p1, p2);&lt;/p&gt;
&lt;p&gt;If thetaapprox is supposed to be an approximation then certainly the amplitude is way off!&lt;br&gt;&lt;br&gt;&lt;/p&gt;</description>
      <guid>134069</guid>
      <pubDate>Fri, 11 May 2012 09:28:38 Z</pubDate>
      <itunes:author>Preben Alsholm</itunes:author>
      <author>Preben Alsholm</author>
    </item>
    <item>
      <title>Thank You!</title>
      <link>http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop?ref=Feed:MaplePrimes:Physics: Bead on a rotating hoop:Comments#comment134092</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop#comment134069"&gt;@Preben Alsholm&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Your a savior you helped me to learn alot about maple and this worked perfectly. Thank you!&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/134013-Physics-Bead-On-A-Rotating-Hoop#comment134069"&gt;@Preben Alsholm&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Your a savior you helped me to learn alot about maple and this worked perfectly. Thank you!&lt;/p&gt;</description>
      <guid>134092</guid>
      <pubDate>Fri, 11 May 2012 22:00:34 Z</pubDate>
      <itunes:author>koonduck</itunes:author>
      <author>koonduck</author>
    </item>
  </channel>
</rss>