JUST NEED THE MATHEMATICAL PART. THANKS!!! Write a C++ program to solve the foll
ID: 3771590 • Letter: J
Question
JUST NEED THE MATHEMATICAL PART.
THANKS!!!
Write a C++ program to solve the following system of three non-linear equations in three variables, using the Method of Newton-Raphson: x^3 + 3y = 1/sin^2(2 theta) y = e^-x y = x + ln(theta) Start the iterations with the following initial guesses: {1,1,1}^T Evaluate the partial derivatives required by the Jacobian Matrix using a centered finite difference approximation Solve for the errors of each variable using simple Gaussian Elimination Proceed with the iterations until the following equation is satisfied: sigma all variables abs(epsilon) LE 10^-5 Your program must display the Jacobian matyrix and the "current" value of each of the variables at every iteration.Explanation / Answer
program for non-lier equation
#include <stdio.h>
#include <math.h>
#include <iostream.h>
void main()
{
double a,b,c,d,detj,detjinv,jinv11,jinv12,jinv21,jinv22,F1,F2,deltax,deltay;
double x,xi,y,yi;
int counter = 0;
cout << " Enter the initial value for T1: ";
cin >> xi;
cout<<" Enter the initial value for T2: ";
cin>>yi;
double f = 0.1;
x = xi;
//y = yi;
int check = 0 ;
while (check ==0)
{
F1 = -322.325*x+1.243*pow(10,-9)*(pow(x,4))-0.6579*y-1.243*pow(10,-9)*(pow(y,4))-52321.635;
F2 = 340.4886*x-9.1821*y-55478.8706+2.379*pow(10,-17)*pow((322.9827*x+169.5321*y-52321.635),4);
a = -322.325+4.972E-9*(pow(x,3));
b = -0.6579-4.972E-9*(pow(x,3));
c = 17.4932+(3.074*pow(10,-14))*pow((52321.635+322.9829*x+169.5321*y),3)-322.9829;
d = 9.1821+(9.5176*pow(10,-17))*pow((52321.635+322.9829*x+169.5321*y),3);
detj = a*d - b*c;
jinv11 = d/detj;
jinv12 = -b/detj;
jinv21 = -c/detj;
jinv22 = a/detj;
detjinv = (((a*d)/(detj*detj)) - ((b*c)/(detj*detj)));
deltax = (jinv11*F1*f)+(jinv12*F2*f);
deltay = (jinv21*F1*f)+(jinv22*F2*f);
x = x-deltax;
y = y-deltay;
}
if((F1 < 0.001) && (F2 < 0.001)
{ check = 1;
}
cout<<" F1 = "<<F1;
cout<<" F2 = "<<F2;
cout<<" x = "<<x;
cout<<" y = "<<y;
}
Program for Newton–Raphson method for computing the approximate of the square root.
program for linear latest squares
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.