This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
pass a numerical equation to a method while taking it input as a string
Posted by rashid on August 09, 2001 at 8:02 PM
i am making a generalized program with GUI in which all the numerical techniques are implemented but the problem is that
i want to take execute the method...(e.g root finding technique)
by pressing a button.. then program prompt user for an equation (which roots are to be calculated) and i've to pass that equation to that root finding class where that equation acts like a mathematical equation or function...
i hope that is enough to define my problem..
somebody told me that the method public process exec(String)
of Runtime class can help but i don't know how..i tried to use it but couldn't. tokenizer is too hard to use 'cause in a mathematical function there are so many function like trignometry, logrithm, exponential and all these can come in equation...
plz suggest some solution. coding is welcome