Numerical Technique Assignment - Zewei Wang - x00180502
Numerical Technique Assignment - Zewei Wang - x00180502
Compound root: If the equation has a plural root, this method may not find them
unless the initial guess has plural parts.
Derivatives of zero or near zero.
Q3:
Q5:
Figure 8: Plot of question
Appendix:
Q1:
clear;
clc
syms f(x,y);
syms g(x,y);
f(x,y)=2-3.2*cos(x)-y^5+2.4*x;
g(x,y)=x^3+3*y^2-5;
df_y=diff(f,y);
dg_x=diff(g,x);
dg_y=diff(g,y);
%Create a 2D column vector and set an err value to start in while loop
Soln=[x_0;y_0];
err = 0.1;
steps = 0
while err>accuracy
b=eval(([f(Temp(1),Temp(2));g(Temp(1),Temp(2))]));
DeltaSoln=eval(J(Temp(1),Temp(2)))\b
Soln=Temp-DeltaSoln
err=max(abs(DeltaSoln(1)),abs(DeltaSoln(2)));
steps = steps+1
end
%Soln=eval(Soln);
Q4:
function rhsderiv=rhsPairdetails(w,s, q)
% this function stores the details of the right hand side of a SET of ODEs
% of the form ds/dw = rhsderiv which is to to be solved numerically,
% where:
% w = independent variable (could use x)
% s = vector of two dependent variables (y and z)
% q = to allow for the passing of extra parameters
% rhsderiv, contains the details of the right hand side of the SET of
ODEs
% this is the example in the notes with f(x, ,y ,z) = x + y + z and
% g(x, y, z) = 1 + y + z
rhsderiv=[s(2), -s(2)-s(1)^3];
return;
Q5:
% w - independent variable
rad1 = s(1);
w1 = s(2);
rad2 = s(3);
w2 = s(4);
%ode function
dtheta1_dt = w1;
dtheta2_dt = w2;
rhsderiv = [s(2), -10.2 * s(1) + 2.2 * s(3), s(4) , -10.2 * s(3) + 2.2 * s(1)];
end
10
1000