<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Solving an ODE with `if`statement</title>
    <link>http://www.mapleprimes.com/questions/35519-Solving-An-ODE-With-ifstatement</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 14:10:39 GMT</lastBuildDate>
    <pubDate>Tue, 09 Jun 2026 14:10:39 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Solving an ODE with `if`statement</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Solving an ODE with `if`statement</title>
      <link>http://www.mapleprimes.com/questions/35519-Solving-An-ODE-With-ifstatement</link>
    </image>
    <item>
      <title>There are a few problems</title>
      <link>http://www.mapleprimes.com/questions/35519-Solving-An-ODE-With-ifstatement?ref=Feed:MaplePrimes:Solving an ODE with `if`statement:Comments#answer44155</link>
      <itunes:summary>&lt;p&gt;There are a few problems with this.&amp;nbsp; First, the if functions are evaluated immediately.&amp;nbsp; Second, the conditions of the if's are expressed as equalities, which will not work. The independent variable (t) is continuous, as such it makes no sense numerically to compare it to any value.&amp;nbsp; You should use inequalities (t&amp;lt;=0, t&amp;lt;=1, t&amp;lt;=2, t&amp;lt;=3). Third, the differential equation has the parameters b, c, and n, which are undefined.&amp;nbsp; Probably they are meant to be functions of e and f.&lt;/p&gt;
&lt;p&gt;You can express the if's using the piecewise function.&amp;nbsp; Here is one approach; I arbitrarily reassigned b, c, and n:&lt;/p&gt;
&lt;pre&gt;
a := .178131:

pw := piecewise(t &amp;lt;= 1, 6, t &amp;lt;= 2, 10, t &amp;lt;= 3, 15, 20):

e := -0.6814e-1*pw:
f := 0.16242e-1*pw^(1.5):

# Arbitrary assignments
n := 2:
b := e:
c := f:

dsys := [diff(Log10S(t), t) = -(a+b+c)*n*(-Log10S(t)/(a+b+c))^((n-1)/n), Log10S(0) = -0.1e-3]:
integ := dsolve(dsys, numeric):
integ(6);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [t = 6., Log10S(t) = -4.28489796949036]

&lt;/pre&gt;</itunes:summary>
      <description>&lt;p&gt;There are a few problems with this.&amp;nbsp; First, the if functions are evaluated immediately.&amp;nbsp; Second, the conditions of the if's are expressed as equalities, which will not work. The independent variable (t) is continuous, as such it makes no sense numerically to compare it to any value.&amp;nbsp; You should use inequalities (t&amp;lt;=0, t&amp;lt;=1, t&amp;lt;=2, t&amp;lt;=3). Third, the differential equation has the parameters b, c, and n, which are undefined.&amp;nbsp; Probably they are meant to be functions of e and f.&lt;/p&gt;
&lt;p&gt;You can express the if's using the piecewise function.&amp;nbsp; Here is one approach; I arbitrarily reassigned b, c, and n:&lt;/p&gt;
&lt;pre&gt;
a := .178131:

pw := piecewise(t &amp;lt;= 1, 6, t &amp;lt;= 2, 10, t &amp;lt;= 3, 15, 20):

e := -0.6814e-1*pw:
f := 0.16242e-1*pw^(1.5):

# Arbitrary assignments
n := 2:
b := e:
c := f:

dsys := [diff(Log10S(t), t) = -(a+b+c)*n*(-Log10S(t)/(a+b+c))^((n-1)/n), Log10S(0) = -0.1e-3]:
integ := dsolve(dsys, numeric):
integ(6);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [t = 6., Log10S(t) = -4.28489796949036]

&lt;/pre&gt;</description>
      <guid>44155</guid>
      <pubDate>Sat, 13 Mar 2010 09:11:13 Z</pubDate>
      <itunes:author>Joe
 Riel
</itunes:author>
      <author>Joe
 Riel
</author>
    </item>
    <item>
      <title>Solving an ODE with `if`statement 2</title>
      <link>http://www.mapleprimes.com/questions/35519-Solving-An-ODE-With-ifstatement?ref=Feed:MaplePrimes:Solving an ODE with `if`statement:Comments#comment44156</link>
      <itunes:summary>&lt;p&gt;Hi Joe:&lt;/p&gt;
&lt;p&gt;Thank you so much for your help.&lt;/p&gt;
&lt;p&gt;You came with an elegant solution, I appreciate it very much.&lt;/p&gt;
&lt;p&gt;Moshe.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Hi Joe:&lt;/p&gt;
&lt;p&gt;Thank you so much for your help.&lt;/p&gt;
&lt;p&gt;You came with an elegant solution, I appreciate it very much.&lt;/p&gt;
&lt;p&gt;Moshe.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <guid>44156</guid>
      <pubDate>Sat, 13 Mar 2010 10:50:50 Z</pubDate>
      <itunes:author>cactus</itunes:author>
      <author>cactus</author>
    </item>
  </channel>
</rss>