+ 3

How to integrate any expression using java?

Should it be import some mathematical tools, or we can integrate directly using logics only

6th Dec 2018, 5:23 AM
Sonu Kumar
Sonu Kumar - avatar
12 Respostas
+ 13
Hy Sonu Kumar By integrate any expression , U mean integration of any expression in java ? ● For integration of Polynomial terms , it will be easy (no need of importing any extra libraries , can be solve through logic only) ● if U want to integrate ANY expression , then it will be a tough to do(involvement of trignometric & logaritmic forms also) [try this link : https://www.quora.com/What-is-the-algorithm-to-integrate-a-function-using-a-computer-program , still only elementary functions , Composite function are might not taken] //M.S.D answer was to find Real roots of quadratic equation //U should go for integration of Polynomial expressions only according to me
6th Dec 2018, 5:48 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 10
Sonu Kumar ● By finding discriminant value -ve , U can make use of iota(i) for representation of imaginary part of roots. ● I made little change in formula for representation : [-b +- -i(-(b^2-4ac))^(1/2)]/(2a) ● -D taken in place of D as value of D will be -ve & sqrt() function don't work for -ve values.
6th Dec 2018, 6:11 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
Mohit the coder, If roots are not real then??
6th Dec 2018, 6:07 AM
Sonu Kumar
Sonu Kumar - avatar
+ 1
Yah
6th Dec 2018, 5:29 AM
Sonu Kumar
Sonu Kumar - avatar
+ 1
Can i solve using java or not?
6th Dec 2018, 5:30 AM
Sonu Kumar
Sonu Kumar - avatar
+ 1
Ok how can i solve it ?
6th Dec 2018, 5:33 AM
Sonu Kumar
Sonu Kumar - avatar
+ 1
Ok sir ... thanks alot
6th Dec 2018, 6:04 AM
Sonu Kumar
Sonu Kumar - avatar
0
You can solve quardatic equation like this class QuadraticEquation { public static void main(String[] args) { /* * Suppose our Quadratic Equation to be solved is 2x2 + 6x + 4 = 0 . * (Assuming that both roots are real valued) * * General form of a Quadratic Equation is ax2 + bx + c = 0 where 'a' is * not equal to 0 * * Hence a = 2, b = 6 and c = 4. */ int a = 2; int b = 6; int c = 4; // Finding out the roots double temp1 = Math.sqrt(b * b - 4 * a * c); double root1 = (-b + temp1) / (2 * a); double root2 = (-b - temp1) / (2 * a); System.out .println("The roots of the Quadratic Equation \"2x2 + 6x + 4 = 0\" are " + root1 + " and " + root2); } }
6th Dec 2018, 5:32 AM
MsJ
MsJ - avatar
0
Yes if you want to use polynomial evalution of expressions then you can do that by regression formulas and polynomial regression evaluator which will evaluate polynomial equation
6th Dec 2018, 5:58 AM
MsJ
MsJ - avatar
0
You can use neumerical integration by simpaon's, rectungular and trapezium, Gauss legendre ect formula to solve the integration
6th Dec 2018, 6:03 AM
MsJ
MsJ - avatar
- 1
Do you mean any quardatic equation, you can use your logic to perform mathematical operation
6th Dec 2018, 5:28 AM
MsJ
MsJ - avatar
- 1
Yes you can solve that easily and if you want to import some mathematical libraries then you can include that java.lang.Math.sqrt(x); import java.lang.Math; Math.sqrt(x); 
6th Dec 2018, 5:32 AM
MsJ
MsJ - avatar