help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DASPK additional input parameters


From: Olaf Till
Subject: Re: DASPK additional input parameters
Date: Fri, 23 Jun 2006 13:32:26 +0200
User-agent: Mutt/1.5.9i

On Fri, Jun 23, 2006 at 09:14:37AM +0200, Carlo de Falco wrote:
> Dear all,
> I apologize if this might seem a silly question:
> Is it possible to pass additional parameters to the RES and JAC functions
> passed to DASPK?
> 
> I mean, to define those functions as
> 
> function res = RES (x,xdot,t,some_other_parameters)
> and
> function J = JAC (x,xdot,t,c,some_other_parameters)
> 
> and have DASPK pass the the additional parameters everytime it needs
> to buil residual and (modified) Jacobian?
> 
> I am doing this with global variables at the moment but I was
> wondering if any other solution exists...
> 
> Thanks in advance,
> Carlo

I am doing similar things (with lsode) with global variables too.

A slightly cleaner way would be using what Matlab calls nested
functions, but I believe they are not implemented in Octave (?).

In principle, handles to anonymous functions should work, probably
something like (assuming you have no jacobian):

function res = RES (x, xdot, t, some_other_parameters)
...
endfunction

... = daspk (@ (x, xdot, t) RES (x, xdot, t,
values_of_some_other_parameters), ...)

but this requires that daspk accepts function handles, and if I
remember rightly, daspk belongs to the small number of functions in
Octave where implementing function handles is problematic --- do not
know the current status.

O. Till



reply via email to

[Prev in Thread] Current Thread [Next in Thread]