aa these bad

This commit is contained in:
LinlyBoi
2023-05-08 23:29:52 +03:00
parent ea01e939e8
commit 07fe9a89b0
2 changed files with 0 additions and 45 deletions

View File

@@ -1,20 +0,0 @@
x = 1.8;
X = [1.7 1.9 2 2.1 2.3];
f = @(x) e.^x;
function solution = divided_diff(x, X, f)
Sigma = 0;
for j = [1:length(X)]
w = 1;
for k = [1:length(X)]
if(j != k)
w = w * ( X(j) - X(k) );
endif
endfor
Sigma = Sigma + ( f(j) / w );
endfor
solution = Sigma;
endfunction
balls = divided_diff(x,X,f)

View File

@@ -1,25 +0,0 @@
clc
clear
%b = [4;9;2];
%A = [3 4 5; 1 3 1; 3 5 9;]; % must be ; in here
%x = A \ b %% balls
function line_equation = line_func(x)
line_equation = 3 * x^2 - e()^x
endfunction
function root = newton_method(a, b, e)
c = (a + b) / 2
if( abs(line_func(c)) <= e)
printf("root found!")
root = c
return
endif
if(line_func(c) < 0)
newton_method(c,b,e)
else
newton_method(a,c,e)
endif
endfunction
newton_method(0,1,10^-10)