comp.lang.ada
 help / color / mirror / Atom feed
* math: passing function to function
@ 2001-04-30 11:12 Staffan Dittmer
  2001-04-30 12:10 ` Jacob Sparre Andersen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Staffan Dittmer @ 2001-04-30 11:12 UTC (permalink / raw)


I'm trying to implement a root finder using the Brent method
but find myself getting stuck. 
I cannot figure  out how to pass a function 
- the function to solve - as a parameter 
to  the solver.

I've tried using access to subprogram types to make something like
function solver(fun: access to function to solve; ...) return long_float;
which usually compiles ok, but exits raising 
constraint error as soon as the code gets more involved than the 
rudimentary examples given in the RM.

I would very much appreciate it if someone could point me to 
some mathematical Ada source code where things like the above 
are bound to be used. 
 
The latest line of thought is that it might be possible to
make a generic construction like

generic
function fun(X:float) return float renames function_to_solve;
function solver(...) return float is
begin 
......

but I have no greater hopes for this being even remotely possible.

Any other ideas?

/ Staffan Dittmer



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-04-30 14:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-30 11:12 math: passing function to function Staffan Dittmer
2001-04-30 12:10 ` Jacob Sparre Andersen
2001-04-30 12:57 ` Marc A. Criley
2001-04-30 13:51   ` Staffan Dittmer
2001-04-30 14:38 ` Ted Dennison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox