Need help combining LSODE with newton [message #42390] |
Wed, 26 January 2005 05:35 |
msp
Messages: 1 Registered: January 2005
|
Junior Member |
|
|
Hi
My local guru can't help me with this, so I was hoping one of you
could.
I am trying to solve a set of differential equations using the
"newton" procedure to solve for the proper boundary conditions and
LSODE to advance the solution (shooting to a fitting point). To use
newton I have written the required function (called Vecfunc in the
reference guide) returning values for the equations newton is supposed
to solve. So far things are working fine, but whenever I try to call
LSODE in this function I get the error message below whether or not I
actually use the results from LSODE:
% NEWTON: File expression not allowed in this context: <No name>.
Can anyone explain why this happens and how to avoid it. Any help at
all will be much appreciated. I have included a simple version of what
I am trying to do below. Note that I am not actually using the result
of LSODE here, just calling it.
Thanks
Morten Stejner
Department of Physics and Astronomy, University of Aarhus
FUNCTION derivs,X,Y
RETURN, [1.,1.,1.,1.]
END
FUNCTION newtfunc, X
H=1
Y=[1.,2.,3.,4.]
test=LSODE(Y,0.0,H,'derivs')
print,Y,test
RETURN, [X[0] + X[1] - 3, X[0]^2 + X[1]^2 - 9]
END
PRO NEWTtest
X = [1.0, 5.0]
Y = NEWTON(X, 'newtfunc')
PRINT, 'For X=[1.0, 5.0], result = ', Y
END
|
|
|