Mathematical Function - defining at run-time?? 
Author Message
 Mathematical Function - defining at run-time??

The short of it.. I'm a novice who never got past ch 2 of any C book, and
only took one term of ADA (UW's idea of a joke, I guess..).

I am writing root finding algorithm's (bisection, newton-raphson, etc),
and would like to prompt for the function at run-time.  I had given up
hope, except for a fortraner who said Fortran could do it.  Is it
possible to prompt for a function, and to be able to solve it, or am I
dreaming....



Mon, 09 Mar 1998 03:00:00 GMT  
 Mathematical Function - defining at run-time??

Quote:

>I am writing root finding algorithm's (bisection, newton-raphson, etc),
>and would like to prompt for the function at run-time.  I had given up
>hope, except for a Fortraner who said Fortran could do it.  Is it
>possible to prompt for a function, and to be able to solve it, or am I
>dreaming....

What you need is a mathematical expression parser...not too difficult
a program to construct. Once the expression is internally compiled
and represented, it is then possible to evaluate or otherwise manipulate
the function. This, however, falls into the realm of sci.math or
sci.math.symbolic, etc..

Best regards,
Derick.
--
+------------------------------------------------------------------------+
| Derick R. Qua-Gonzalez                                      | ________ |
| Department of Physics, California State University          | \      / |

|     ``It is better to be hated for what one is,             |   \  /   |
|       than loved for what one is not.'' (A. Gide)           | G  \/ USA|
+-------------------------------------------------------------+----------+



Mon, 09 Mar 1998 03:00:00 GMT  
 Mathematical Function - defining at run-time??
Sorry if it's a stupid question.
Is it possible in UNIX to pass the arguments to a C program, not in the

i.e., instead of

myprog command1 command2 command3... commandn

would be


where command is a file that contains command1 - commandn

TIA

Carlos



Tue, 10 Mar 1998 03:00:00 GMT  
 Mathematical Function - defining at run-time??
=>   The short of it.. I'm a novice who never got past ch 2 of any C book, and
=>   only took one term of ADA (UW's idea of a joke, I guess..).
=>
=>   I am writing root finding algorithm's (bisection, newton-raphson, etc),
=>   and would like to prompt for the function at run-time.  I had given up
=>   hope, except for a Fortraner who said Fortran could do it.  Is it
=>   possible to prompt for a function, and to be able to solve it, or am I
=>   dreaming....

        There's no built-in way to do this, but the functions to do it
are common, and you probably find them in a good C tools book.  You
need a function to convert a string in infix notation to RPN (the hard
part) and then a function to calculate the answers using the RPN
notation. (the easy part).  
--
Jason C. Austin



Tue, 10 Mar 1998 03:00:00 GMT  
 Mathematical Function - defining at run-time??


|=>   The short of it.. I'm a novice who never got past ch 2 of any C book, and
|=>   only took one term of ADA (UW's idea of a joke, I guess..).
|=>
|=>   I am writing root finding algorithm's (bisection, newton-raphson, etc),
|=>   and would like to prompt for the function at run-time.  I had given up
|=>   hope, except for a Fortraner who said Fortran could do it.  Is it
|=>   possible to prompt for a function, and to be able to solve it, or am I
|=>   dreaming....

|       There's no built-in way to do this, but the functions to do it
|are common, and you probably find them in a good C tools book.  You
|need a function to convert a string in infix notation to RPN (the hard
|part) and then a function to calculate the answers using the RPN
|notation. (the easy part).  

Just to make one point clear: There's no built-in way to do this in
Fortran, either.
--
                Matthew Saltzman
                Clemson University Math Sciences



Tue, 10 Mar 1998 03:00:00 GMT  
 Mathematical Function - defining at run-time??
Quote:

>I am writing root finding algorithm's (bisection, newton-raphson, etc),
>and would like to prompt for the function at run-time.  I had given up

Check in any Simtel mirror: /msdos/math/formu220.zip
That should do the job.
BTW, if you find any other translators, please post or e-mail

Thanks

Carlos



Tue, 10 Mar 1998 03:00:00 GMT  
 Mathematical Function - defining at run-time??


Quote:
>Sorry if it's a stupid question.
>Is it possible in UNIX to pass the arguments to a C program, not in the

>i.e., instead of

>myprog command1 command2 command3... commandn

>would be


>where command is a file that contains command1 - commandn

System specific questions are not appropriate to comp.lang.c - try a
newsgroup appropriate to your system such as comp.unix.programmer. There
are several ways to tackle this in Unix and 'man sh' or possibly 'man xargs'
should tell you what you want.

--
-----------------------------------------


-----------------------------------------



Tue, 10 Mar 1998 03:00:00 GMT  
 Mathematical Function - defining at run-time??


:> Sorry if it's a stupid question.
:> Is it possible in UNIX to pass the arguments to a C program, not in the

:> i.e., instead of
:> myprog command1 command2 command3... commandn
:> would be

:> Carlos
:
:Sure...why not!
:

:
:Neither DOS or Unix does this for you automatically. You must scan for

:read the arguments from the file.

myprog `cat command`
[comp.unix.programmer topic]

----



Mon, 23 Mar 1998 03:00:00 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Run time error (#define) challeng !!

2. Calling DLL functions without known function name, parameter-list until run-time

3. Run-time type define

4. Function question Part 2 ( RUN TIME ERROR PROBLEM )

5. not calling function at run time ..

6. Trigger function to run one time per day?!?

7. Dynamically(run-time) adding functions to a program.

8. run time function call

9. C function call at run time

10. Call a function with an argument list built up at run time

11. run-time function loading help

12. run time error with GetFieldValue function

 

 
Powered by phpBB® Forum Software