<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">

<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.emailstyle17
        {font-family:Arial;
        color:navy;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.emailstyle18
        {font-family:Arial;
        color:maroon;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.emailstyle19
        {font-family:Arial;
        color:maroon;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle20
        {font-family:Arial;
        color:maroon;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi all,</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I&#8217;m new to python and want to start
using it as a replacement for the too-expensive MATLAB.&nbsp; To that end,
I&#8217;ve been playing around with the ode solver, as it&#8217;s a central
feature of a simulation I&#8217;m working on now in MATLAB.&nbsp; I finally got
the solver working, but there are some things about it that seem cumbersome or
not ideal.&nbsp; I&#8217;m hoping you can help</span></font><font size=2
color=maroon face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:maroon'> </span></font><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>me figure out a better
way of implementing it&#8230;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>First, my test code is attached.&nbsp;
It&#8217;s a system of three coupled equations, an example taken from the
MATLAB documentation on their ode45 function.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'><font size=2
color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>1)</span></font><font size=1 color=navy><span style='font-size:
7.0pt;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>The Y output from ode seems to be of type array. &nbsp;That is,
I&#8217;m solving a system of three coupled equations, so for each iteration
the solver generates an array of three elements as well as the time at that
iteration.&nbsp; So, as you can see in my code, I append the output from each
iteration.&nbsp; This ends up giving me a list of three-element arrays.&nbsp;
This seems to be a rather cumbersome way of organizing the output and makes
plotting it rather laborious.&nbsp; The only way I&#8217;ve been able to plot
it is by running a for-loop in which I populate three other lists (y1,y2,y3)
with the appropriate values from the ode solver.&nbsp;Then I can plot it (see
attached code).&nbsp; As I said, this seems overly-laborious.&nbsp; Any
suggestions?</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:.5in;text-indent:-.25in'><font size=2
color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>2)</span></font><font size=1 color=navy><span style='font-size:
7.0pt;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>The basic solver scipy.integrate.ode requires you to specify the
time step. &nbsp;I would prefer a solver with an adaptive time step
algorithm.&nbsp; What do you suggest I do for this?</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Any help is appreciated.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>thanks,</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>trevis</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>________________________________________________</span></font></p>

<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Trevis Crane</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Postdoctoral Research Assoc.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Department of Physics</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
  10.0pt;font-family:Arial;color:navy'>University</span></font><font size=2
 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
 color:navy'> of </span></font><font size=2 color=navy face=Arial><span
  style='font-size:10.0pt;font-family:Arial;color:navy'>Ilinois</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>1110 </span></font><font size=2
  color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
  color:navy'>W. Green St</span></font><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
  10.0pt;font-family:Arial;color:navy'>Urbana</span></font><font size=2
 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
 color:navy'>, </span></font><font size=2 color=navy face=Arial><span
  style='font-size:10.0pt;font-family:Arial;color:navy'>IL</span></font><font
 size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
 color:navy'> </span></font><font size=2 color=navy face=Arial><span
  style='font-size:10.0pt;font-family:Arial;color:navy'>61801</span></font></p>

<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>p: 217-244-8652</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>f: 217-244-2278</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>e: <a href="mailto:tcrane@uiuc.edu">tcrane@uiuc.edu</a></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>________________________________________________</span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;</span></font></p>

</div>

</body>

</html>