Mathematical functions

does anybody know of a class that allows a functon of two variables (z = f(x, y)) to be input by a user, then parsed to provide a z-value if the x and y values are given? This is to render the surfaces graphically. (I know, write it myself... I'm lazy. Shoot me.) Thanks
[285 byte] By [kdoheny] at [2007-9-26 7:08:34]
# 1

Hi,

Are you refer to the pointer to function used in C?

This may not be the correct approach but it may offer something close to what you are looking for:

public class Test

{

public static void main(String[] arg)

{

Common c = null;

if(arg[0].equals("0"))

{

c = new Add();

}

else

c= new Sub();

Test tt= new Test();

tt.test(c,2,1);

}

public void test(Common c, int a, int b)

{

System.out.println(c.function(a,b));

}

}

interface Common

{

public int function(int a, int b);

}

class Add implements Common

{//this is the add function

public int function(int a, int b)

{

return a+b;

}

}

class Sub implements Common

{

public int function(int a, int b)

{

return a-b;

}

}

wongmk at 2007-7-1 16:50:04 > top of Java-index,Archived Forums,Java Programming...
# 2
Check out JEP, http://jep.sourceforge.net
jsalonen at 2007-7-1 16:50:04 > top of Java-index,Archived Forums,Java Programming...
# 3
This looks like exactly what I need. Thanks.
kdoheny at 2007-7-1 16:50:04 > top of Java-index,Archived Forums,Java Programming...