hello all :
I have a problem in extracting the double values and the negative values from the mathimatical equation
in my project I stored the equations in array of string so every index have one equation
I want to extract the values from this equation
like this :
array [0]= 2.2*x1+3*x2-4x3-3.8x4
I want to extract the values in the first array like { 2.2 , 3 , -4 , -3.8 }
and the second array { x1 , x2 , x3 , x4 }
hint : my project in the simplex method in lenear programming I need help plez
I work with java language
3 Replies - 466 Views - Last Post: 25 April 2011 - 07:47 PM
#1
how can I extract the double values of variables from the equation?
Posted 25 April 2011 - 07:09 PM
Replies To: how can I extract the double values of variables from the equation?
#2
Re: how can I extract the double values of variables from the equation?
Posted 25 April 2011 - 07:14 PM
Moved to Java.
Take a look at the String split() method. You can split around the + and - signs, and then just parse out the coefficient from the x's.
Take a look at the String split() method. You can split around the + and - signs, and then just parse out the coefficient from the x's.
#3
Re: how can I extract the double values of variables from the equation?
Posted 25 April 2011 - 07:21 PM
frist I used this to read line by line from JTextarea
String s[] = area.getText().split("\n");;
for(int i = 0 ; i<s.length ;i++)
{
System.out.println("Array of"+i +"is "+ s[i]);
}
then I have a problem when I deals with other conditions (+ , - , . )
what shall I do ?
String s[] = area.getText().split("\n");;
for(int i = 0 ; i<s.length ;i++)
{
System.out.println("Array of"+i +"is "+ s[i]);
}
then I have a problem when I deals with other conditions (+ , - , . )
what shall I do ?
#4
Re: how can I extract the double values of variables from the equation?
Posted 25 April 2011 - 07:47 PM
I need help please
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|