These are the four (out of eight) first results I get with the MATLAB code:<br>----<br>&gt;&gt; nonhomog(0.2)<br>nonhomog: using 300 grid points.<br><br>BC1_disc_left =<br><br>  -4.8436e-12<br><br><br>BC1_disc_right =<br><br>

  -1.1027e-13<br><br><br>BC2_disc_left =<br><br>  -1.1269e-11<br><br><br>BC2_disc_right =<br><br>  -1.8657e-13<br><br><br>lambda =<br><br>    0.9976<br><br><br>V0 =<br><br>   79.0637<br><br>nonhomog: using 300 grid points.<br>

<br>BC1_disc_left =<br><br>   8.5855e-12<br><br><br>BC1_disc_right =<br><br>  -1.4955e-13<br><br><br>BC2_disc_left =<br><br>  -9.4851e-12<br><br><br>BC2_disc_right =<br><br>   3.7053e-12<br><br><br>lambda =<br><br>    0.9969<br>

<br><br>V0 =<br><br>   79.0637<br><br>nonhomog: using 300 grid points.<br><br>BC1_disc_left =<br><br>  -4.2669e-12<br><br><br>BC1_disc_right =<br><br>  -3.8908e-15<br><br><br>BC2_disc_left =<br><br>  -1.0330e-10<br><br><br>

BC2_disc_right =<br><br>   8.6403e-13<br><br><br>lambda =<br><br>    0.5464<br><br><br>V0 =<br><br>   79.0606<br><br>nonhomog: using 300 grid points.<br><br>BC1_disc_left =<br><br>   2.9082e-12<br><br><br>BC1_disc_right =<br>

<br>  -5.5045e-15<br><br><br>BC2_disc_left =<br><br>  -8.5076e-13<br><br><br>BC2_disc_right =<br><br>   3.7712e-13<br><br><br>lambda =<br><br>  -54.3440<br><br><br>V0 =<br><br>   78.6880<br>----<br><br>These are the four results I get with my Python code:<br>

----<br>python nonhomog.py <br>kappa =  15.7079632679<br>alpha =  0<br>nu =  0.2<br>nx_ =  300<br>BC1_disc_left =  (nan+nanj)<br>BC1_disc_right =  (nan+nanj)<br>BC2_disc_left =  (nan+nanj)<br>BC2_disc_right =  (nan+nanj)<br>

lambda =  -0.774244159818<br>nonhomog.py:81: DeprecationWarning: integer argument expected, got float<br>  xx = range(-kappa, h, kappa+1)<br>kappa =  15.7079632679<br>alpha =  5.80527619798e-06<br>nu =  0.2<br>nx_ =  300<br>

BC1_disc_left =  (nan+nanj)<br>BC1_disc_right =  (nan+nanj)<br>BC2_disc_left =  (nan+nanj)<br>BC2_disc_right =  (nan+nanj)<br>lambda =  -0.774244180107<br>kappa =  15.7079632679<br>alpha =  0.000580527619798<br>nu =  0.2<br>

nx_ =  300<br>BC1_disc_left =  (nan+nanj)<br>BC1_disc_right =  (nan+nanj)<br>BC2_disc_left =  (nan+nanj)<br>BC2_disc_right =  (nan+nanj)<br>lambda =  -0.774246188696<br>kappa =  15.7079632679<br>alpha =  0.0580527619798<br>

nu =  0.2<br>nx_ =  300<br>BC1_disc_left =  (nan+nanj)<br>BC1_disc_right =  (nan+nanj)<br>BC2_disc_left =  (nan+nanj)<br>BC2_disc_right =  (nan+nanj)<br>lambda =  -0.774447043715<br>----<br><br>Some questions:<br><br>1. For example, the sign of the lambdas are wrong not to mention that the values are not even near the corresponding MATLAB values. How to fix these?<br>

<br>2. Also, I get those annoying (nan+nanj) messages for BC1s and BC2s. What&#39;s wrong?<br><br>3. There is also this error message: &quot;nonhomog.py:81: DeprecationWarning: integer argument expected, got float<br>
  xx = range(-kappa, h, kappa+1)&quot;. How should I fix that?<br><br>Thanks!<br><br>Henri.<br><br><div class="gmail_quote">2010/11/16 Henri Heinonen <span dir="ltr">&lt;<a href="mailto:henri.heinonen@mbnet.fi">henri.heinonen@mbnet.fi</a>&gt;</span><br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi!<br><br>Can you, please, try to help me with Python? I try to convert a MATLAB program to Python.<br>

<br>Here are the MATLAB codes:<br><a href="http://pastebin.com/MbPZ8Z7X" target="_blank">http://pastebin.com/MbPZ8Z7X</a><br><a href="http://pastebin.com/dDnF5AF2" target="_blank">http://pastebin.com/dDnF5AF2</a><br>
<br>Here is my Python code:<br><a href="http://pastebin.com/jCPdLHx7" target="_blank">http://pastebin.com/jCPdLHx7</a><br><br>What is wrong with my Python code? The program doesn&#39;t produce quite the same lambdas as the MATLAB program does.<br>


<br>Thanks for all the help!<br><font color="#888888"><br>Henri.<br>
</font></blockquote></div>