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:
(x + Math.pow (y, 2)) / (Math.cbrt(3)+y)
- Write Java expression for following.
x= a*b+(1.0/2.0)*c*Math.pow(b,2);
- Write an expression in java for:
A= ( Math.pow((a+b),2 ) * Math.pow((a-b),3)) / 2*a*b
- Write an expression in java for:
X=Math.abs(A)+ Math.abs(B) +(Math.pow(A,3)+ Math.pow(B,4))
- Write an expression in java for:
x=Math.sqrt ((2 * Math.pow(x,3) + 3*Math.pow(y,2) ) / (x+y)
- Write an expression in java for:
A= Math.sqrt(Math.pow(p,x) + Math.pow(q,2));
- Write equivalent Java expressions for the following:
- Math.sqrt(a+b)
- 1/3.0*Math.pow(a,3)+1/3.0*Math.pow(b,3)
- Write equivalent Java expressions for the following:
- s=u*t+1/2.0*a*Math.pow(t,2)
- d=Math.sqrt(l*l+b*b);
- Write equivalent Java expressions for the following:
- (-b+Math.sqrt(b*b-4*a*c))/(2*a) and (-b-Math.sqrt(b*b-4*a*c))/(2*a)
- (Math.pow(a,3)+Math.pow(b,3))/ (Math.pow(a,3)-Math.pow(b,3))
- Write equivalent Java expressions for the following:
- Math.abs((a*a*a+b*b*b)/(a*a*a-b*b*b))
- Math.cbrt((a+b)/(a*b))
- Write equivalent Java expressions for the following:
- Math.pow(a+b,n)/Math.sqrt(3+b)
- Z=(5*x*x*x+2*y)/(x+y);
- Write equivalent Java expressions for the following:
- (a*a+b*b)/(a+b)
- T=Math.sqrt(A*A+B*B+C*C);
- Write equivalent Java expressions for the following:
ax5+bx3+c
Ans.a*Math.pow(x,5)+b*Math.pow(x,3)+c