Question

Find out the solution for the given equation iteratively that at which integer value this equation...

Find out the solution for the given equation iteratively that at which integer value this
equation will get balance.
? = ?
? − ? ∗ ?

Teacher i need solution in c++ and python thanks

Homework Answers

Answer #1

CODE:

#include<iostream>
#include<math.h>
//The given code implements the Newton Raphson iterative scheme for finding the root of the equation 2-2x
using namespace std;
double fun(double x) //Given function 2-2x
{
   double f=2-2*x;
   return f;
}
double fund(double x) //Derivative of the function -2
{
   double fd=-2;
   return fd;
}
main()
{
   double errmax=0.0001; //Defining maximum error
   double x=0,xn; //Taking initial guess of root as 0
   while(true)
   {
       xn=x-fun(x)/fund(x);
       if((fabs(xn-x)<errmax))
       break;
       x=xn;
   }
   cout<<"Root is: "<<xn;
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
For Problems 33–36, find the general solution to the given differential equation and the maximum interval...
For Problems 33–36, find the general solution to the given differential equation and the maximum interval on which the solution is valid. y'' = xn, n an integer.
find the general solution of the given differential equation. Give the largest interval I over which...
find the general solution of the given differential equation. Give the largest interval I over which the general solution is defined. Determine whether there are any transient terms in the general solution dy/dx +y = e3x
A nonhomogeneous equation and a particular solution are given. Find a general solution for the equation....
A nonhomogeneous equation and a particular solution are given. Find a general solution for the equation. y''+5y'+6y=24x^(2)+40x+8+12e^(x), y_p(x)=e^(x)+4x^(2) The general solution is y(x)= ​(Do not use​ d, D,​ e, E,​ i, or I as arbitrary constants since these letters already have defined​ meanings.)
Find the general solution of the given differential equation. State an interval on which the general...
Find the general solution of the given differential equation. State an interval on which the general solution is defined. cos2xsinxdy+ (ycos3x−1)dx= 0
Combinatorial Math: Find the number of nonnegative integer solutions to the equation a+b+c=249. We are given:...
Combinatorial Math: Find the number of nonnegative integer solutions to the equation a+b+c=249. We are given: 10 ≤ a ≤ 30  (you can use an ellipsis between values in this factor instead of listing them all) b is even and b > 50 c ≥ 144 a) Set up the generating function. Do not multiply it out. Do not use a, b or c in the function. Use x as the variable. The first factor should relate to a, the second...
Solve the given equation. (Enter your answers as a comma-separated list. Let k be any integer....
Solve the given equation. (Enter your answers as a comma-separated list. Let k be any integer. Round terms to three decimal places where appropriate. If there is no solution, enter NO SOLUTION.) 2 sin(2θ) − 3 sin(θ) = 0 #### I need the answer in the format 2pik + 5pi/6, 2pik+3pi/2....etc
Find the general solution of the given differential equation. Give the largest interval over which the...
Find the general solution of the given differential equation. Give the largest interval over which the general solution is defined. y'+2xy=x5
Find the general solution of the given differential equation. Give the largest interval over which the...
Find the general solution of the given differential equation. Give the largest interval over which the general solution is defined. y'+2xy=x5
You are given the following equation. 4x2 + 49y2 = 196 (a) Find dy / dx...
You are given the following equation. 4x2 + 49y2 = 196 (a) Find dy / dx by implicit differentiation. dy / dx = (b) Solve the equation explicitly for y and differentiate to get dy / dx in terms of x. (Consider only the first and second quadrants for this part.) dy / dx = (c) Check that your solutions to parts (a) and (b) are consistent by substituting the expression for y into your solution for part (a). (Do...
3.Solve the given equation. (Enter your answers as a comma-separated list. Let k be any integer....
3.Solve the given equation. (Enter your answers as a comma-separated list. Let k be any integer. Round terms to three decimal places where appropriate. If there is no solution, enter NO SOLUTION.) 2 sin2(θ) − cos(θ) = 1 #### I need the answer in the format 2pik + 5pi/6, 2pik+3pi/2....etc