Question

In: Computer Science

write me a java progrm that does this: y=x^3 +1 drivative of y=3X^2+0 y=mx+b m is...

write me a java progrm that does this:

y=x^3 +1

drivative of y=3X^2+0

y=mx+b

m is slope for x=2 put 2 back to equation y=3(2)^2=12

now we have 12 and y=9 so

9=2(12)+b and we find b=-15

now we write new equation that with these information

y=12x-15 we solve for 12x-15=0, we solve for x and x=15/12=1.25

now we do the same thing above we put at the drivative equation y=3(1.25)^2+0=4.6875

now we put this to 2.943125=(4.6875)*3+b

we solve for b=-2.90625

y=4.6875x-2.90625 and 4.6875x-2.90625=0 we solve for x and =0.62 now we use this as we did above to find another new equation and this go in a loop to do the same thing over and over to find new point and equation

Solutions

Expert Solution

/*----------------------------------------------------\
|save code 'equation.java' |
|compile using 'javac equation.java'       |
|run using 'java equation' |
\----------------------------------------------------*/

import java.lang.Math;

//your file name class name must be same here file name is 'equation.java'
class equation{
   public static void main(String args[]){

       float x = 2f;//initial value of x which is given
       int i = 6;//loop iterator
       for(i=0; i<6; i++){//calling in loop over and over again
           x = printEquation(x);
       }

   }
   // Function to find values and equation
   public static float printEquation(float x){
       float y1, m, b, output;
       y1 = (float) Math.pow(x, 3) + 1;//given function---(1)
       m = (float) Math.pow(x, 2) * 3;//darivative of function(1) slope
       b = (float) y1 - m*x;//intersection part of equation
       output = (float) (-1)*b / m;//next x value
       System.out.println("\nFor value x = "+x);
       System.out.println("Equation will be y = ("+m+")*x + ("+b+")\n");
       return output;
   }
}

//screen shots



Related Solutions

Let f(x,y)= (3/2)(x^2+y^2 ) in 0≤x≤1, 0≤y≤1. (a) Find V(X) (b) Find V(Y)
Let f(x,y)= (3/2)(x^2+y^2 ) in 0≤x≤1, 0≤y≤1. (a) Find V(X) (b) Find V(Y)
dervive the Frobenius solution to 4(x^2)*y"(x)+(3x+1)y(x)=0
dervive the Frobenius solution to 4(x^2)*y"(x)+(3x+1)y(x)=0
solve the initial values: if Y(3)-4Y"+20Y'=51e^3x Y"(0)=41, Y'(0)= 11. Y(0)= 7 > solution is Y(x)= e^3x+2...
solve the initial values: if Y(3)-4Y"+20Y'=51e^3x Y"(0)=41, Y'(0)= 11. Y(0)= 7 > solution is Y(x)= e^3x+2 e^2x sin(4x)+6 so, what is the solution for: Y(3)-8Y"+17Y'=12e^3x Y"(0)=26, Y'(0)= 7. Y(0)= 6 Y(x)=???
Solve the following differential equations: 1.) y"(x)+ y(x)=4e^x ; y(0)=0, y'(0)=0 2.) x"(t)+3x'(t)+2x(t)=4t^2 ; x(0)=0, x'(0)=0
Solve the following differential equations: 1.) y"(x)+ y(x)=4e^x ; y(0)=0, y'(0)=0 2.) x"(t)+3x'(t)+2x(t)=4t^2 ; x(0)=0, x'(0)=0
Given: f(x,y) = 5 - 3x - y for 0 < x,y < 1 and x...
Given: f(x,y) = 5 - 3x - y for 0 < x,y < 1 and x + y < 1, 0 otherwise 1) find the covariance of x and y 2) find the marginal probability density function for x c) find the probability that x >= 0.6 given that y <= 0.2
  Solve a.      x + y = 3, 2x – y = 1 b.      3x + 2y = 6,...
  Solve a.      x + y = 3, 2x – y = 1 b.      3x + 2y = 6, x = 3 c.      2x + y = 4, y = -2x + 1 d.      x – 3y = 6, 2x – y =1
Solve (1+e^x)dy/dx+(e^x)y=3x^2+1 Solve (x^3+y^3)dx+3xy^2 dy = 0 Solve (y-cos y)dx + (xsiny+x)dy = 0 Solve (1+ln...
Solve (1+e^x)dy/dx+(e^x)y=3x^2+1 Solve (x^3+y^3)dx+3xy^2 dy = 0 Solve (y-cos y)dx + (xsiny+x)dy = 0 Solve (1+ln x +y/x)dx = (1-lnx)dy Solve (y^2+yx)dx - x^2dy =0 Solve (x^2+2y^2)dx = xydy Solve Bernoulli's Equation x dy/dx + 2y = (x^4)(e^x)(y^2) Solve Bernoulli's Equation (1+x^2) dy/dx = 2xy +(e^x)(y^2) Solve IVP (3e^(x^2))dy + (xy^2)dx=0 ; y(1) = 2 Solve IVP dy/dx -2xy = e^(x^2) ; y(0)=0 Solve IVP (x^2+y^2)dx+(2xy)dy=0; y(1)=1 6. Mixture Problem Initially 40 lb of salt is dissolved in a large...
Solve the IVP using Laplace transforms x' + y'=e^t -x''+3x' +y =0 x(0)=0, x'(0)=1, y(0)=0
Solve the IVP using Laplace transforms x' + y'=e^t -x''+3x' +y =0 x(0)=0, x'(0)=1, y(0)=0
Solve for x x^4 + 2x^3 + 2x^2 + 3x + 1 = 0
Solve for x x^4 + 2x^3 + 2x^2 + 3x + 1 = 0
Suppose f(x,y)=(1/8)(6-x-y) for 0<x<2 and 2<y<4. a. Find p(Y<3|X=1) b. Find p(Y<3|0.5<X<1)
Suppose f(x,y)=(1/8)(6-x-y) for 0<x<2 and 2<y<4. a. Find p(Y<3|X=1) b. Find p(Y<3|0.5<X<1)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT