Answer:
Java expression for the following:-
(a+b)²+b
\sf \: z=x³+y³+ \frac{xy}{3}z=x³+y³+
3
xy
Answer:-
There are two ways to write it as a Java Expression:-
\sf{(a+b)^2 + b}(a+b)
2
+b
Math.pow((a+b),2)+b
((a+b)*(a+b))+b
\sf{x^3 + y^3 + (\dfrac{xy}{3})}x
3
+y
3
+(
3
xy
)
z=(x*x*x)+(y*y*y)+((x*y)/3);
z=Math.pow(x,3)+Math.pow(y,3)+((x*y)/3);
Note:-
Math.pow() returns the number raised to power other number
It always returns the double type value
More about Math Functions:-
Math.max() is used to find the maximum value between 2 numbers. SYNTAX:- Math.max(a,b);
Math.min() returns the minimum value between two numbers. SYNTAX:- Math.min(x,y);
Math.abs() returns absolute value of the given number. SYNTAX:- Math.abs();
Math.ceil() returns rounded value upto nearest higher integer. SYNTAX:- Math.ceil(x);
Math.floor() returns rounded value upto nearest lower integer. SYNTAX;- Math.floor(x);
Math.round() returns the rounded value of the number upto nearest integer.
Math.cbrt() returns cube root of a number. SYNTAX:- Math.cbrt(x);
Math.sqrt() returns square root of a number. SYNTAX:- Math.sqrt(x);