Re: Reading/Writing files

2011-03-18 Thread Jon Herman
Wow, Jack, that is one awesome and simple module...thank you so much! I am happily storing and accessing all the arrays I could ever want :) Thanks to all for the quick assistance! On Fri, Mar 18, 2011 at 4:24 PM, Jack Trades wrote: > > On Fri, Mar 18, 2011 at 5:21 PM, Jon Herman

Re: Reading/Writing files

2011-03-18 Thread Jon Herman
on windows, and doesn't require escaping ("/foo/bar"). > > On Fri, Mar 18, 2011 at 2:56 PM, Jon Herman wrote: > >> Jack, >> >> thanks. >> >> Alright, so what I did is create a file called hello.txt with a single >> line of text in ther

Re: Reading/Writing files

2011-03-18 Thread Jon Herman
t the following error: IOError: [Errno 13] Permission denied: 'f' If I open to read, I get: IOError: [Errno 2] No such file or directory: 'f' Can anyone explain to me why this happens? On Fri, Mar 18, 2011 at 3:50 PM, Jack Trades wrote: > > On Fri, Mar 18, 2011 at 4:33

Reading/Writing files

2011-03-18 Thread Jon Herman
Hello all, I am pretty new to Python and am trying to write data to a file. However, I seem to be misunderstanding how to do so. For starters, I'm not even sure where Python is looking for these files or storing them. The directories I have added to my PYTHONPATH variable (where I import modules f

Re: Numerical representation

2011-03-08 Thread Jon Herman
ize for asking your time for such a beginner's oversight...I'll be fluent in Python some day ;-) On Mon, Mar 7, 2011 at 5:34 PM, Robert Kern wrote: > On 3/7/11 2:52 PM, Jon Herman wrote: > >> It really is exactly the same process, but sure. Below is my Matlab >> translat

Re: Numerical representation

2011-03-07 Thread Jon Herman
Thanks Terry! Of course, speed is not my main concern at this point and I'm more worried about precision...would you have some input on this discussion? :) Jon On Mon, Mar 7, 2011 at 2:35 PM, Terry Reedy wrote: > On 3/7/2011 1:59 PM, Jon Herman wrote: > >> And for the sak

Re: Numerical representation

2011-03-07 Thread Jon Herman
x=xwrk + dt * Xtemp2; t=twrk+dt; On Mon, Mar 7, 2011 at 1:50 PM, Chris Rebert wrote: > >>> On Fri, Mar 4, 2011 at 2:32 PM, Jon Herman > wrote: > >>>> > >>>> I am new to the Python language and writing a Runge-Kutta-Fellberg > 7(8) &

Re: Numerical representation

2011-03-07 Thread Jon Herman
And for the sake of additional completeness (I'm sorry I didn't think of all this in one go): my derivative function in Python produces results that agree with MATLAB to order e-16 (machine precision), so the error is definitely building up in my integrator. On Mon, Mar 7, 2011 at 11:

Re: Numerical representation

2011-03-07 Thread Jon Herman
-mu)*(X[0]+mu)/r1**3-mu*(X[0]-(1-mu))/r2**3 Ay= X[1]-2*X[3]-(1-mu)*X[1]/r1**3-mu*X[1]/r2**3 Az= -(1-mu)*X[2]/r1**3-mu*X[2]/r2**3 XDelta=array([X[3], X[4], X[5], Ax, Ay, Az]) return XDelta On Mon, Mar 7, 2011 at 11:50 AM, Jon Herman wrote: > Sorry Robert, I'd missed y

Numerical representation

2011-03-07 Thread Jon Herman
Sorry Robert, I'd missed your post when I just made my last one. The output I am getting in Python looks as follows: array([ 9.91565050e-01, 1.55680112e-05, -1.53258602e-05, -5.75847623e-05, -9.64290960e-03, -8.26333458e-08]) This is the final state vector, consisting of 6 states (p

Re: Numerical representation

2011-03-07 Thread Jon Herman
mp2+c[l]*k[:,l] X=Xold + dt * Xtemp2 t=told+dt Xstore=vstack((Xstore,X)) tstore=vstack((tstore,t)) if abs(tf-t)< 1e-14: print('At tf') break On Fri, Mar 4, 2011 at 6:46 PM, Jon Herman wrote: > Actually,

Re: Numerical representation

2011-03-04 Thread Jon Herman
2011 at 4:49 PM, Santoso Wijaya wrote: > Have you taken a look at numpy? [1] It was written for exactly this kind of > usage. > > ~/santa > > [1] http://numpy.scipy.org/ > > > On Fri, Mar 4, 2011 at 2:32 PM, Jon Herman wrote: > >> Hello all, >> >>

Numerical representation

2011-03-04 Thread Jon Herman
Hello all, I am new to the Python language and writing a Runge-Kutta-Fellberg 7(8) integrator in Python, which requires an extreme numerical precision for my particular application. Unfortunately, I can not seem to attain it. The interesting part is if I take my exact code and translate it to Matl