

%%Matlab code for Newton Raphson method
clear all
close all
syms x
% function for which root have to find
f(x)=-x^5-4*x^4+2*x^3+x^2-3*x+5;
fprintf('function for which d value have to find\n')
disp(f)
%1st Derivative of this function
g1(x)=- 5*x^4 - 16*x^3 + 6*x^2 + 2*x - 3;
fprintf('1st Derivative of this function\n')
disp(g1)
max_it=100;
%Maximum number of iterations
xx=0;
%initial guess
fprintf('Newton iteration for initial guess %f\n',xx)
fprintf('\t k\t x\t f(x) \tdf(x)/dx\n')
%Loop for all intial guesses
n=10^-6; %error limit for close itteration
for i=1:max_it
fprintf('\t%d \t%2.5f
\t%2.5f \t%2.5f\n',i-1,xx,f(xx),g1(xx))
x2=double(xx-(f(xx)./g1(xx))); %Newton Raphson Formula
cc=abs(xx-x2);
%Error
xx=x2;
if cc<=n
break
end
end
fprintf('\nThe function is f(x)=\n')
disp(f)
fprintf('Value of x for the function is %f for
total iteration count %d.\n\n',xx,i)
max_it=100;
%Maximum number of iterations
xx=-20;
%initial guess
fprintf('Newton iteration for initial guess %f\n',xx)
fprintf('\t k\t x\t f(x) \tdf(x)/dx\n')
%Loop for all intial guesses
n=10^-6; %error limit for close itteration
for i=1:max_it
fprintf('\t%d \t%2.5f
\t%2.5f \t%2.5f\n',i-1,xx,f(xx),g1(xx))
x2=double(xx-(f(xx)./g1(xx))); %Newton Raphson Formula
cc=abs(xx-x2);
%Error
xx=x2;
if cc<=n
break
end
end
fprintf('\nThe function is f(x)=\n')
disp(f)
fprintf('Value of x for the function is %f for
total iteration count %d.\n\n',xx,i)
%%%%%%%%%%%%%%%%%% End of Code
%%%%%%%%%%%%%%%%%%
1) (80pts) Consider the following function f(x)--x5-4x4 + 2x3 + x2-3x + 5 Develop a simple program which will give an iterative solution to the problem f(x)=0 by Newton's algorithm. The solut...
Problem 4. Consider f(x) = x5+ x4 + 2x3 + 3x2 + 4x + 5 ∈ Q[x] and our goal is to determine if f is irreducible over Q. We compute f(1), f(−1), f(5), f(−5) directly and see that none of them is zero. By the Rational Roots Theorem, f has no root in Q. So if f is reducible over Q, it cannot be factored into the product of a linear polynomial and a quartic polynomial (i.e. polynomial of...
solve problem #1 depending on the given information
Consider the following 1D second order elliptic equation with Dirichlet boundary conditions du(x) (c(x)du ) = f(x) (a $15 b), u(a) = ga, u(b) = gb dr: where u(x) is the unknown function, ga and gb are the Dirichlet boundary values, c(x) is a given coefficient function and f(x) is a given source function. See the theorem 10.1 in the textbook for the existence and uniqueness of the solution. 1.1 Weak Formulation...