Write the Java expressions for the following :
i.
2
2 2
ab
a + b
ii. z = ax3 + bx3 + c
Answers
Explanation:
Simply Coding
JAVA
Forming Math Expressions
Categories
JAVA, OPERATORS, MATH LIBRARY
Before we start attempting the questions on Java Math class, lets do a quick revision on Java libraries and Math class in particular.
Click here -> Java Class Libraries
Lets Start!
Write a Java expression for the following:
5/10+ x5 + 4/ bx3
Ans.
5.0/10.0 + Math.pow(x,5) + 4.0/ b * Math.pow(x, 3)
Write the Java expression for
ax5 + bx3 + c
Ans.
a * Math.pow(x, 5) + b * Math.pow(x, 3) + c
Write down java expression for :
T = square root (A2 + B2 + C2)
Ans.
double T = Math.sqrt(Math.pow(A, 2) + Math.pow(B, 2) + Math.pow(C, 2));
Write the Java expression for:
(A2 + B2 )/ 2ab
Ans.
(Math.pow(a, 2) + Math.pow(b, 2)) / (2 * a * b)
Write the java expressions for each of the following:
(i) x = e|2x – 4x|
(ii) s=√(sin(a) + tan(a) – e2x)
Ans:
(i) x = Math.exp(Math.abs(2*x-4*x))
(ii) s = Math.sqrt(Math.sin(a)+Math.tan(a)-Math.exp(2*x))
Write an expression for:
Ans.
(x + Math.pow (y, 2)) / (Math.cbrt(3)+y)
Write Java expression for following.
Ans.
x= a*b+(1.0/2.0)*c*Math.pow(b,2);
Write an expression in java for:
Ans.
A= ( Math.pow((a+b),2 ) * Math.pow((a-b),3)) / 2*a*b
Write an expression in java for:
Ans.
X=Math.abs(A)+ Math.abs(B) +(Math.pow(A,3)+ Math.pow(B,4))