ajout de l'intro a julia
This commit is contained in:
parent
32d7e615c9
commit
96aadf2976
BIN
julia/notebook_Julia.pdf
Normal file
BIN
julia/notebook_Julia.pdf
Normal file
Binary file not shown.
1535
julia/scr-julia/.ipynb_checkpoints/intro-julia-checkpoint.ipynb
Normal file
1535
julia/scr-julia/.ipynb_checkpoints/intro-julia-checkpoint.ipynb
Normal file
File diff suppressed because it is too large
Load diff
7954
julia/scr-julia/.ipynb_checkpoints/ode-exemple-sol-checkpoint.ipynb
Normal file
7954
julia/scr-julia/.ipynb_checkpoints/ode-exemple-sol-checkpoint.ipynb
Normal file
File diff suppressed because one or more lines are too long
2
julia/scr-julia/cmd.jl
Executable file
2
julia/scr-julia/cmd.jl
Executable file
|
@ -0,0 +1,2 @@
|
|||
println(ARGS)
|
||||
|
1535
julia/scr-julia/intro-julia.ipynb
Normal file
1535
julia/scr-julia/intro-julia.ipynb
Normal file
File diff suppressed because it is too large
Load diff
13904
julia/scr-julia/ode-exemple-sol.ipynb
Normal file
13904
julia/scr-julia/ode-exemple-sol.ipynb
Normal file
File diff suppressed because one or more lines are too long
8
julia/scr-julia/prog1.jl
Executable file
8
julia/scr-julia/prog1.jl
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/Applications/Julia-1.4.app/Contents/Resources/julia/bin/julia
|
||||
|
||||
function helloworld()
|
||||
println("Hello, World!") # Bye bye, MATLAB!
|
||||
end
|
||||
|
||||
helloworld()
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
"<center>\n",
|
||||
"<h1> TP-Projet d'optimisation numérique </h1>\n",
|
||||
"<h1> Année 2020-2021 - 2e année département Sciences du Numérique </h1>\n",
|
||||
"<h1> Nom: </h1>\n",
|
||||
"<h1> Prénom: </h1> \n",
|
||||
"<h1> Noms: </h1>\n",
|
||||
"<h1> Prénoms: </h1> \n",
|
||||
"</center>"
|
||||
]
|
||||
},
|
||||
|
@ -26,7 +26,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
@ -34,52 +34,26 @@
|
|||
"output_type": "stream",
|
||||
"text": [
|
||||
"-------------------------------------------------------------------------\n",
|
||||
"\u001b[34m\u001b[1mRésultats de : Newton appliqué à f2 au point initial [0.0, 0.0050000000010000005]:\u001b[22m\u001b[39m\n",
|
||||
" * xsol = [0.0, 0.0]\n",
|
||||
"\u001b[34m\u001b[1mRésultats de : Newton appliqué à f0 au point initial -1.5707963267948966:\u001b[22m\u001b[39m\n",
|
||||
" * xsol = [0.0]\n",
|
||||
" * f(xsol) = 0\n",
|
||||
" * nb_iters = 0\n",
|
||||
" * flag = 0\n",
|
||||
" * sol_exacte : [1, 1]\n",
|
||||
"hess_f2(xmin) = [2.0 -0.0; -0.0 200.0]\n",
|
||||
"cond(H) = 100.0\n",
|
||||
" * sol_exacte : -1.5707963267948966\n",
|
||||
"-------------------------------------------------------------------------\n",
|
||||
"\u001b[34m\u001b[1mRésultats de : Newton appliqué à f2 au point initial [0.0, 0.0050000000010000005]:\u001b[22m\u001b[39m\n",
|
||||
" * xsol = [0.0, 0.0]\n",
|
||||
"\u001b[34m\u001b[1mRésultats de : Newton appliqué à f0 au point initial -1.0707963267948966:\u001b[22m\u001b[39m\n",
|
||||
" * xsol = [0.0]\n",
|
||||
" * f(xsol) = 0\n",
|
||||
" * nb_iters = 0\n",
|
||||
" * flag = 0\n",
|
||||
" * sol_exacte : [1, 1]\n",
|
||||
"hess_f2(xmin) = [2.0 -0.0; -0.0 200.0]\n",
|
||||
"cond(H) = 100.0\n",
|
||||
" * sol_exacte : -1.5707963267948966\n",
|
||||
"-------------------------------------------------------------------------\n",
|
||||
"\u001b[34m\u001b[1mRésultats de : Newton appliqué à f2 au point initial [0.0, 0.0050000000010000005]:\u001b[22m\u001b[39m\n",
|
||||
" * xsol = [0.0, 0.0]\n",
|
||||
"\u001b[34m\u001b[1mRésultats de : Newton appliqué à f0 au point initial 1.5707963267948966:\u001b[22m\u001b[39m\n",
|
||||
" * xsol = [0.0]\n",
|
||||
" * f(xsol) = 0\n",
|
||||
" * nb_iters = 0\n",
|
||||
" * flag = 0\n",
|
||||
" * sol_exacte : [1, 1]\n",
|
||||
"hess_f2(xmin) = [2.0 -0.0; -0.0 200.0]\n",
|
||||
"cond(H) = 100.0\n",
|
||||
"-------------------------------------------------------------------------\n",
|
||||
"\u001b[34m\u001b[1mRésultats de : Newton appliqué à f2 au point initial [0.0, 0.0050000000010000005]:\u001b[22m\u001b[39m\n",
|
||||
" * xsol = [0.0, 0.0]\n",
|
||||
" * f(xsol) = 0\n",
|
||||
" * nb_iters = 0\n",
|
||||
" * flag = 0\n",
|
||||
" * sol_exacte : [1, 1]\n",
|
||||
"hess_f2(xmin) = [2.0 -0.0; -0.0 200.0]\n",
|
||||
"cond(H) = 100.0\n",
|
||||
"-------------------------------------------------------------------------\n",
|
||||
"\u001b[34m\u001b[1mRésultats de : Newton appliqué à f2 au point initial [0.0, 0.0050000000010000005]:\u001b[22m\u001b[39m\n",
|
||||
" * xsol = [0.0, 0.0]\n",
|
||||
" * f(xsol) = 0\n",
|
||||
" * nb_iters = 0\n",
|
||||
" * flag = 0\n",
|
||||
" * sol_exacte : [1, 1]\n",
|
||||
"hess_f2(xmin) = [2.0 -0.0; -0.0 200.0]\n",
|
||||
"cond(H) = 100.0\n",
|
||||
"[-2.0, 1.0000000002]\n",
|
||||
"[-4.000000330961484e-10 -0.0; -0.0 200.0]\n"
|
||||
" * sol_exacte : -1.5707963267948966\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -111,56 +85,17 @@
|
|||
"# la hessienne de la fonction f0\n",
|
||||
"hess_f0(x) = -sin(x)\n",
|
||||
"sol_exacte = -pi/2\n",
|
||||
"x0 = -pi/2+0.5\n",
|
||||
"options = []\n",
|
||||
"xmin,f_min,flag,nb_iters = Algorithme_De_Newton(f0,grad_f0,hess_f0,x0,options)\n",
|
||||
"#my_afficher_resultats(\"Newton\",\"f0\",x0,xmin,f_min,flag,sol_exacte,nb_iters)\n",
|
||||
"\n",
|
||||
"# Fonction f1\n",
|
||||
"# -----------\n",
|
||||
"f1(x) = 2*(x[1]+x[2]+x[3]-3)^2 + (x[1]-x[2])^2 + (x[2]-x[3])^2\n",
|
||||
"# la gradient de la fonction fct1\n",
|
||||
"function grad_f1(x)\n",
|
||||
" y1 = 4*(x[1]+x[2]+x[3]-3) + 2*(x[1]-x[2])\n",
|
||||
" y2 = 4*(x[1]+x[2]+x[3]-3) - 2*(x[1]-x[2]) +2*(x[2]-x[3])\n",
|
||||
" y3 = 4*(x[1]+x[2]+x[3]-3) - 2*(x[2]-x[3])\n",
|
||||
" return [y1;y2;y3]\n",
|
||||
"end\n",
|
||||
"# la hessienne de la fonction fct1\n",
|
||||
"hess_f1(x) = [6 2 4;2 8 2;4 2 6]\n",
|
||||
"sol_exacte = [1;1;1]\n",
|
||||
"options = []\n",
|
||||
"x0 = [1; 0; 0]\n",
|
||||
"xmin,f_min,flag,nb_iters = Algorithme_De_Newton(f1,grad_f1,hess_f1,x0,options)\n",
|
||||
"#my_afficher_resultats(\"Newton\",\"f1\",x0,xmin,f_min,flag,sol_exacte,nb_iters)\n",
|
||||
"x0 = [10; 3; -2.2]\n",
|
||||
"xmin,f_min,flag,nb_iters = Algorithme_De_Newton(f1,grad_f1,hess_f1,x0,options)\n",
|
||||
"#my_afficher_resultats(\"Newton\",\"f1\",x0,xmin,f_min,flag,sol_exacte,nb_iters)\n",
|
||||
"\n",
|
||||
"f2(x)=100*(x[2]-x[1]^2)^2+(1-x[1])^2\n",
|
||||
"grad_f2(x)=[-400*x[1]*(x[2]-x[1]^2)-2*(1-x[1]) ; 200*(x[2]-x[1]^2)]\n",
|
||||
"hess_f2(x)=[-400*(x[2]-3*x[1]^2)+2 -400*x[1];-400*x[1] 200]\n",
|
||||
"sol_exacte = [1;1]\n",
|
||||
"options = []\n",
|
||||
"x0 = [-1.2; 1]\n",
|
||||
"x0 = sol_exacte\n",
|
||||
"xmin,f_min,flag,nb_iters = Algorithme_De_Newton(f2,grad_f2,hess_f2,x0,options)\n",
|
||||
"#my_afficher_resultats(\"Newton\",\"f2\",x0,xmin,f_min,flag,sol_exacte,nb_iters)\n",
|
||||
"x0 = [10.; 0]\n",
|
||||
"xmin,f_min,flag,nb_iters = Algorithme_De_Newton(f2,grad_f2,hess_f2,x0,options)\n",
|
||||
"#my_afficher_resultats(\"Newton\",\"f2\",x0,xmin,f_min,flag,sol_exacte,nb_iters)\n",
|
||||
"x0 = [0 ; 1/200+1/1.e12]\n",
|
||||
"options = [1 ; sqrt(eps()) ; 1e-15]\n",
|
||||
"for i in 1:5\n",
|
||||
" options[1] = i\n",
|
||||
" xmin,f_min,flag,nb_iters = Algorithme_De_Newton(f2,grad_f2,hess_f2,x0,options)\n",
|
||||
" my_afficher_resultats(\"Newton\",\"f2\",x0,xmin,f_min,flag,sol_exacte,nb_iters)\n",
|
||||
" H = hess_f2(xmin)\n",
|
||||
" println(\"hess_f2(xmin) = \",H)\n",
|
||||
" println(\"cond(H) = \", cond(H))\n",
|
||||
"end\n",
|
||||
"println(grad_f2(x0))\n",
|
||||
"println(hess_f2(x0))"
|
||||
"xmin,f_min,flag,nb_iters = Algorithme_De_Newton(f0,grad_f0,hess_f0,x0,options)\n",
|
||||
"my_afficher_resultats(\"Newton\",\"f0\",x0,xmin,f_min,flag,sol_exacte,nb_iters)\n",
|
||||
"x0 = -pi/2+0.5\n",
|
||||
"xmin,f_min,flag,nb_iters = Algorithme_De_Newton(f0,grad_f0,hess_f0,x0,options)\n",
|
||||
"my_afficher_resultats(\"Newton\",\"f0\",x0,xmin,f_min,flag,sol_exacte,nb_iters)\n",
|
||||
"x0 = pi/2\n",
|
||||
"xmin,f_min,flag,nb_iters = Algorithme_De_Newton(f0,grad_f0,hess_f0,x0,options)\n",
|
||||
"my_afficher_resultats(\"Newton\",\"f0\",x0,xmin,f_min,flag,sol_exacte,nb_iters)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue