init bruv
This commit is contained in:
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2023 Author
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
32
LU.m
Normal file
32
LU.m
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
|
||||
# upper matrix ballocks.
|
||||
clear,clc
|
||||
#U2 = -A(2,1)/A(1,1) * A(1, :) + A(2, :)
|
||||
#U3 = -A(3,1)/A(1,1) * A(1, :) + A(3, :)
|
||||
#U_temp = [A(1,:); U2; U3]
|
||||
#U3 = -A(3,2)/U_temp(2,2) * U_temp(2, :) + U_temp(3, :)
|
||||
#U = [A(1,:); U2; U3]
|
||||
#L = [1, 0, 0; A(2,1)/A(1,1),1,0;(A(3,1)/A(1,1)),(A(3,2)/U_temp(2,2)),1]
|
||||
|
||||
# U_temp var = A (matrix)
|
||||
# for i < n
|
||||
# j = i + 1
|
||||
# for j <= n
|
||||
# U_temp(j, :) = -U_temp(j,i)/U_temp(j,i) * U_temp(i, :) + U_temp(j, :)
|
||||
|
||||
A = [5,2,4;2,1,1;1,-5,-3];
|
||||
b = [17;0;13;];
|
||||
U_temp = A
|
||||
L_temp = eye(3);
|
||||
for i = [1:length(A)-1]
|
||||
for j = [i+1: length(A)]
|
||||
L_temp(j,i) = U_temp(j,i)/U_temp(i,i);
|
||||
U_temp(j, :) = -U_temp(j,i)/U_temp(i,i) * U_temp(i, :) + U_temp(j, :);
|
||||
endfor
|
||||
endfor
|
||||
U_temp
|
||||
L_temp
|
||||
#another for loop that's like we create another matrix for Z
|
||||
L_temp*U_temp\b
|
||||
25
newton.m
Normal file
25
newton.m
Normal file
@@ -0,0 +1,25 @@
|
||||
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)
|
||||
1
the greatest
Normal file
1
the greatest
Normal file
@@ -0,0 +1 @@
|
||||
# Created by Octave 7.3.0, Sun Mar 05 13:19:01 2023 EET <libkyy@Jeffersonian>
|
||||
Reference in New Issue
Block a user