<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, E with one random variable</title>
    <link>http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Wed, 10 Jun 2026 18:59:20 GMT</lastBuildDate>
    <pubDate>Wed, 10 Jun 2026 18:59:20 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, E with one random variable</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, E with one random variable</title>
      <link>http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable</link>
    </image>
    <item>
      <title>An experimental attempt</title>
      <link>http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable?ref=Feed:MaplePrimes:E with one random variable:Comments#answer143617</link>
      <itunes:summary>&lt;p&gt;I don't quite see in your code any attempt to implement the piecewise defined A at the top. Presumably (t,365) is meant as t-floor(t/365)*365. &lt;br&gt;&lt;br&gt;Knowing nothing about stochastic differential equations the following should be taken as an experiment.&lt;br&gt;The example used is only somewhat similar to yours.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Added: A somewhat simpler looking way at the bottom.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;restart;&lt;br&gt;#The ode considered is&lt;br&gt;ode:=diff(U(t),t)=-(Ap(t)+r(t)+B*U(t))*U(t);&lt;br&gt;#where Ap is a piecewise defined function, B is a constant, and r is a random variable here defined as: &lt;br&gt;&lt;br&gt;r:=RandomTools:-Generate(distribution(Normal(0, .5)), makeproc=true);&lt;br&gt;#We shall not use ode at all, but use procedural input to dsolve/numeric:&lt;br&gt;&lt;br&gt;p:=proc(N,t,Y,YP) local Ap,B;&lt;br&gt;&amp;nbsp;&amp;nbsp; B:=.1;&lt;br&gt;&amp;nbsp;&amp;nbsp; Ap:=piecewise(t&amp;lt;=1,.1+ 0.4*t,0.5+ 0.004*t);&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp; YP[1]:=-(Ap+r(t)+B*Y[1])*Y[1] &lt;br&gt;end proc;&lt;br&gt;#It appears to me that the only reasonable method is a forward method with no error corrections. &lt;br&gt;#Thus I use the simple Euler method classical[foreuler]. &lt;br&gt;#Choose some stepsize consistent with the application we have in mind.&lt;br&gt;#Here chosen arbitrarily to 0.01.&lt;br&gt;res:=dsolve(numeric,procedure=p,number=1,initial=Array([1]),start=0,procvars=[U(t)],method=classical[foreuler],stepsize=0.01);&lt;br&gt;plots:-odeplot(res,[t,U(t)],0..2);&lt;/p&gt;
&lt;p&gt;#########################################&lt;br&gt;##&lt;strong&gt;Another way and I guess simpler looking.&lt;/strong&gt;&lt;br&gt;restart;&lt;br&gt;ode:=diff(U(t),t)=-(Ap(t)+r(t)+B*U(t))*U(t);&lt;br&gt;R:=RandomTools:-Generate(distribution(Normal(0,.5)), makeproc=true);&lt;br&gt;r:=proc(t) &lt;br&gt;&amp;nbsp;&amp;nbsp; if not type(t,numeric) then return 'procname(_passed)' end if;&lt;br&gt;&amp;nbsp;&amp;nbsp; R()&lt;br&gt;end proc;&lt;br&gt;Ap:=t-&amp;gt;piecewise(t&amp;lt;=1,.1+ 0.4*t,0.5+ 0.004*t); &lt;br&gt;B:=0.1:&lt;br&gt;res:=dsolve({ode,U(0)=1},numeric,known=r(t),method=classical[foreuler],stepsize=0.01);&lt;br&gt;plots:-odeplot(res,[t,U(t)],0..2);&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;I don't quite see in your code any attempt to implement the piecewise defined A at the top. Presumably (t,365) is meant as t-floor(t/365)*365. &lt;br&gt;&lt;br&gt;Knowing nothing about stochastic differential equations the following should be taken as an experiment.&lt;br&gt;The example used is only somewhat similar to yours.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Added: A somewhat simpler looking way at the bottom.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;restart;&lt;br&gt;#The ode considered is&lt;br&gt;ode:=diff(U(t),t)=-(Ap(t)+r(t)+B*U(t))*U(t);&lt;br&gt;#where Ap is a piecewise defined function, B is a constant, and r is a random variable here defined as: &lt;br&gt;&lt;br&gt;r:=RandomTools:-Generate(distribution(Normal(0, .5)), makeproc=true);&lt;br&gt;#We shall not use ode at all, but use procedural input to dsolve/numeric:&lt;br&gt;&lt;br&gt;p:=proc(N,t,Y,YP) local Ap,B;&lt;br&gt;&amp;nbsp;&amp;nbsp; B:=.1;&lt;br&gt;&amp;nbsp;&amp;nbsp; Ap:=piecewise(t&amp;lt;=1,.1+ 0.4*t,0.5+ 0.004*t);&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp; YP[1]:=-(Ap+r(t)+B*Y[1])*Y[1] &lt;br&gt;end proc;&lt;br&gt;#It appears to me that the only reasonable method is a forward method with no error corrections. &lt;br&gt;#Thus I use the simple Euler method classical[foreuler]. &lt;br&gt;#Choose some stepsize consistent with the application we have in mind.&lt;br&gt;#Here chosen arbitrarily to 0.01.&lt;br&gt;res:=dsolve(numeric,procedure=p,number=1,initial=Array([1]),start=0,procvars=[U(t)],method=classical[foreuler],stepsize=0.01);&lt;br&gt;plots:-odeplot(res,[t,U(t)],0..2);&lt;/p&gt;
&lt;p&gt;#########################################&lt;br&gt;##&lt;strong&gt;Another way and I guess simpler looking.&lt;/strong&gt;&lt;br&gt;restart;&lt;br&gt;ode:=diff(U(t),t)=-(Ap(t)+r(t)+B*U(t))*U(t);&lt;br&gt;R:=RandomTools:-Generate(distribution(Normal(0,.5)), makeproc=true);&lt;br&gt;r:=proc(t) &lt;br&gt;&amp;nbsp;&amp;nbsp; if not type(t,numeric) then return 'procname(_passed)' end if;&lt;br&gt;&amp;nbsp;&amp;nbsp; R()&lt;br&gt;end proc;&lt;br&gt;Ap:=t-&amp;gt;piecewise(t&amp;lt;=1,.1+ 0.4*t,0.5+ 0.004*t); &lt;br&gt;B:=0.1:&lt;br&gt;res:=dsolve({ode,U(0)=1},numeric,known=r(t),method=classical[foreuler],stepsize=0.01);&lt;br&gt;plots:-odeplot(res,[t,U(t)],0..2);&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;/p&gt;</description>
      <guid>143617</guid>
      <pubDate>Mon, 18 Feb 2013 21:44:50 Z</pubDate>
      <itunes:author>Preben Alsholm</itunes:author>
      <author>Preben Alsholm</author>
    </item>
    <item>
      <title>Thank you for your replay. I was going wrong&amp;nbsp</title>
      <link>http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable?ref=Feed:MaplePrimes:E with one random variable:Comments#comment143623</link>
      <itunes:summary>&lt;p&gt;Thank you for your replay. I was going wrong&amp;nbsp;using&amp;nbsp;rand().&lt;/p&gt;
&lt;p&gt;I am trying to run the code that you provided but I have problem on this part:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;Ap:=piecewise(t&amp;nbsp;&amp;nbsp; YP[1]:=-(Ap+r(t)+B*Y[1])*Y[1]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I get:&amp;nbsp;Error, unable to match delimiters&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I added delimiter&amp;nbsp;Ap:=piecewise(t&amp;nbsp;&amp;nbsp; YP[1]):=-(Ap+r(t)+B*Y[1])*Y[1]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I get:&amp;nbsp;&lt;/span&gt;Error, `:=` unexpected&lt;/p&gt;
&lt;p&gt;The second code works.&lt;/p&gt;
&lt;p&gt;Thank you so much for your helpful replay. I will&amp;nbsp;carefully go through it to understand the process.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thank you for your replay. I was going wrong&amp;nbsp;using&amp;nbsp;rand().&lt;/p&gt;
&lt;p&gt;I am trying to run the code that you provided but I have problem on this part:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;Ap:=piecewise(t&amp;nbsp;&amp;nbsp; YP[1]:=-(Ap+r(t)+B*Y[1])*Y[1]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I get:&amp;nbsp;Error, unable to match delimiters&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I added delimiter&amp;nbsp;Ap:=piecewise(t&amp;nbsp;&amp;nbsp; YP[1]):=-(Ap+r(t)+B*Y[1])*Y[1]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I get:&amp;nbsp;&lt;/span&gt;Error, `:=` unexpected&lt;/p&gt;
&lt;p&gt;The second code works.&lt;/p&gt;
&lt;p&gt;Thank you so much for your helpful replay. I will&amp;nbsp;carefully go through it to understand the process.&lt;/p&gt;</description>
      <guid>143623</guid>
      <pubDate>Tue, 19 Feb 2013 00:41:37 Z</pubDate>
      <itunes:author>reemeaaaah</itunes:author>
      <author>reemeaaaah</author>
    </item>
    <item>
      <title>The MaplePrimes editor has a problem</title>
      <link>http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable?ref=Feed:MaplePrimes:E with one random variable:Comments#comment143633</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable#comment143623"&gt;@reemeaaaah&lt;/a&gt; The MaplePrimes editor very often leaves out everything on a line after &amp;lt;.&lt;br&gt;That is quite a nuissance.&lt;br&gt;I corrected it. I hope it is OK now.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable#comment143623"&gt;@reemeaaaah&lt;/a&gt; The MaplePrimes editor very often leaves out everything on a line after &amp;lt;.&lt;br&gt;That is quite a nuissance.&lt;br&gt;I corrected it. I hope it is OK now.&lt;/p&gt;</description>
      <guid>143633</guid>
      <pubDate>Tue, 19 Feb 2013 05:21:42 Z</pubDate>
      <itunes:author>Preben Alsholm</itunes:author>
      <author>Preben Alsholm</author>
    </item>
    <item>
      <title>@Preben Alsholm&amp;nbsp;
It works thank you so much</title>
      <link>http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable?ref=Feed:MaplePrimes:E with one random variable:Comments#comment143641</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable#comment143633"&gt;@Preben Alsholm&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It works thank you so much&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/143595-E-With-One-Random-Variable#comment143633"&gt;@Preben Alsholm&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It works thank you so much&lt;/p&gt;</description>
      <guid>143641</guid>
      <pubDate>Tue, 19 Feb 2013 08:10:58 Z</pubDate>
      <itunes:author>reemeaaaah</itunes:author>
      <author>reemeaaaah</author>
    </item>
  </channel>
</rss>