Skip to content

Commit

Permalink
Terminaison de la méthode des différences finies, optimisation de la …
Browse files Browse the repository at this point in the history
…méthode de Tir
  • Loading branch information
Rowin committed Apr 10, 2013
1 parent 6a25da5 commit 35a6bea
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 12 deletions.
Binary file modified Cramer.mn
Binary file not shown.
5 changes: 3 additions & 2 deletions Cramer.mu
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ Cramer := hold(proc(A, l)
name Cramer;
local detA, k, n, solutions;
begin
detA := linalg::det(A);
detA := float(numeric::det(A));
n := sqrt(nops(A));
solutions := [];
for k from 1 to n do
solutions := [op(solutions), linalg::det(linalg::setCol(A, k, l))/detA]
solutions := [op(solutions), float(numeric::det(linalg::setCol(A, k, l))/de\
tA)]
end_for;
return(solutions)
end_proc):
Expand Down
Binary file modified Differenciation.mn
Binary file not shown.
21 changes: 14 additions & 7 deletions Differenciation.mu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Differenciation := hold(proc(A, B, C, D, x0, x1, y0, y1, r, variable)
name Differenciation;
local pas, i, k, listeA, listeD, matA;
local pas, i, k, listeA, listeD, matA, points, solution;
begin
pas := (x1 - x0)/(r + 1);
A := fp::unapply(A, variable);
Expand All @@ -15,20 +15,27 @@ begin
k := 0;
for i from x0 + pas to x1 - pas step pas do
k := k + 1;
listeA := [op(listeA), [0*j $ j = 1..k - 1, a(i), b(i), c(i), 0*j $ j = k +\
3..r]];
listeA := [op(listeA), [0*j $ j = 1..k - 1, float(a(i)), float(b(i)), float\
(c(i)), 0*j $ j = k + 3..r]];
if i = x0 + pas then
listeD := [op(listeD), D(i) - a(x0)*y0]
listeD := [op(listeD), float(D(i) - a(x0)*y0)]
else
if i = x1 - pas then
listeD := [op(listeD), D(i) - c(i)*y1]
listeD := [op(listeD), float(D(i) - c(i)*y1)]
else
listeD := [op(listeD), D(i)]
listeD := [op(listeD), float(D(i))]
end_if
end_if
end_for;
matA := linalg::delCol(linalg::delCol(matrix(listeA), r + 2), 1);
matD := matrix(listeD);
return(matA, matD)
solution := Cramer(matA, matD);
t := 0;
points := [];
for i from x0 + pas to x1 - pas step pas do
t := t + 1;
points := [op(points), [i, solution[t]]]
end_for;
return(points)
end_proc):

Binary file added Reso.mn
Binary file not shown.
2 changes: 2 additions & 0 deletions Reso.mu
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
delete Reso:

Binary file modified Tir.mn
Binary file not shown.
8 changes: 5 additions & 3 deletions Tir.mu
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ begin
b := b + hb
end_while;
fab := RK(f, g, x0, x1, y0, (a + b)/2, 100)[-1][2];
w := 1;
repeat
if y1 < fab then
a := float((a + b)/2)
Expand All @@ -45,13 +46,14 @@ begin
b := float((a + b)/2)
end_if
end_if;
fab := RK(f, g, x0, x1, y0, (a + b)/2, 100)[-1][2];
fab := RK(f, g, x0, x1, y0, (a + b)/2, floor(exp(floor(p/w) + 10)))[-1][2];\

w := abs(fab - y1)/abs(y1);
print(w)
print(w, floor(exp(floor(p/w) + 10)))
until w <= p end_repeat;
fonction := [];
derivee := [];
points := RK(f, g, x0, x1, y0, (a + b)/2, 100);
points := RK(f, g, x0, x1, y0, (a + b)/2, floor(exp(11)));
for i from 1 to nops(points) do
fonction := [op(fonction), [points[i][1], points[i][2]]];
derivee := [op(derivee), [points[i][1], points[i][3]]]
Expand Down
Binary file modified main.mn
Binary file not shown.

0 comments on commit 35a6bea

Please sign in to comment.