Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!yale!zador-anthony From: zador-anthony@CS.YALE.EDU (anthony zador) Newsgroups: comp.lang.c Subject: evaluating math w/o recompile Message-ID: <72603@yale-celray.yale.UUCP> Date: 14 Sep 89 17:35:26 GMT References: <7598@goofy.megatest.UUCP> <34566@apple.Apple.COM> <556@tigger.planet.bt.co.uk> <451@siswat.UUCP> Sender: root@yale.UUCP Reply-To: zador-anthony@CS.YALE.EDU (anthony zador) Organization: Yale University Computer Science Dept, New Haven CT 06520-2158 Lines: 42 I have functions of the form double f(V,t) double V,t; { return (some math function involving about a line of exp, division, mult and add on V, t) } I use these functions to construct a table: Table(f, table_array) ptr_to_fun f; double_array table_array; { construct table_array by evaluating f[n] } I would like to be able to specify the form of the function f at *run time* (no recompiles). That is, i would like to place a line of math in some file and have the program read it in and evaluate it. For example, my fnct could be 1.6/(1+exp(-0.072*(V-5.0))) or 0.02*(V+8.69)/(exp((V+8.69)/5.36)-1) I have played around with "hoc", the high order calculator described in the Unix Programming Environment by K&P, but that seems like overkill for this task. Is there a simpler way? I'd appreciate any ideas. --Tony Zador zador@yale-sun3-nebula.arpa zador@nebula.sun3.cs.yale.edu