compilation du notebook

This commit is contained in:
Laureηt 2021-12-17 17:16:13 +01:00
parent 484273f683
commit 3171ac1366
No known key found for this signature in database
GPG key ID: D88C6B294FD40994

View file

@ -16,7 +16,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -37,24 +37,25 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m registry at `~/.julia/registries/General.toml`\n",
"\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n", "\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n",
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Project.toml`\n", "\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Project.toml`\n",
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Manifest.toml`\n", "\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Manifest.toml`\n",
"\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n", "\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n",
"\u001b[32m ✓ \u001b[39mTestOptinum\n", "\u001b[32m ✓ \u001b[39mTestOptinum\n",
" 1 dependency successfully precompiled in 2 seconds (262 already precompiled, 2 skipped during auto due to previous errors)\n", " 1 dependency successfully precompiled in 4 seconds (262 already precompiled, 2 skipped during auto due to previous errors)\n",
"\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n", "\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n",
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Project.toml`\n", "\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Project.toml`\n",
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Manifest.toml`\n", "\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Manifest.toml`\n",
"\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n", "\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n",
"\u001b[32m ✓ \u001b[39mTestOptinum\n", "\u001b[32m ✓ \u001b[39mTestOptinum\n",
" 1 dependency successfully precompiled in 2 seconds (262 already precompiled, 2 skipped during auto due to previous errors)\n", " 1 dependency successfully precompiled in 3 seconds (262 already precompiled, 2 skipped during auto due to previous errors)\n",
"\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n", "\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n",
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Project.toml`\n", "\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Project.toml`\n",
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Manifest.toml`\n", "\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/.julia/environments/v1.7/Manifest.toml`\n",
"\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n", "\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n",
"\u001b[32m ✓ \u001b[39mTestOptinum\n", "\u001b[32m ✓ \u001b[39mTestOptinum\n",
" 1 dependency successfully precompiled in 2 seconds (262 already precompiled, 2 skipped during auto due to previous errors)\n" " 1 dependency successfully precompiled in 3 seconds (262 already precompiled, 2 skipped during auto due to previous errors)\n"
] ]
} }
], ],
@ -77,7 +78,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -234,7 +235,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -324,7 +325,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -435,7 +436,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -558,9 +559,102 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec newton appliqué à fonction 1 au point initial x01 :\u001b[22m\u001b[39m\n",
" * xsol = [0.5000000000372675, 1.2499999999813662, 0.5000000000372676]\n",
" * f(xsol) = 2.2499999996645914\n",
" * nb_iters = 1000\n",
" * flag = 1\n",
" * sol_exacte = [0.5, 1.25, 0.5]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec newton appliqué à fonction 1 au point initial x02 :\u001b[22m\u001b[39m\n",
" * xsol = [0.5000000300375855, 1.2499999849812073, 0.5000000300375853]\n",
" * f(xsol) = 2.2499997296617393\n",
" * nb_iters = 8\n",
" * flag = 0\n",
" * sol_exacte = [0.5, 1.25, 0.5]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec newton appliqué à fonction 2 au point initial x03 :\u001b[22m\u001b[39m\n",
" * xsol = [0.907233957253261, 0.8227554503916317]\n",
" * f(xsol) = 0.008615651265083814\n",
" * nb_iters = 4\n",
" * flag = 0\n",
" * sol_exacte = [0.9072339605110892, 0.82275545631455]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec newton appliqué à fonction 2 au point initial x04 :\u001b[22m\u001b[39m\n",
" * xsol = [0.9072339605360173, 0.822755456359869]\n",
" * f(xsol) = 0.008615650655277892\n",
" * nb_iters = 1000\n",
" * flag = 1\n",
" * sol_exacte = [0.9072339605110892, 0.82275545631455]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec gct appliqué à fonction 1 au point initial x01 :\u001b[22m\u001b[39m\n",
" * xsol = [0.5000000000022053, 1.2499999999899234, 0.5000000000022053]\n",
" * f(xsol) = 2.249999999980151\n",
" * nb_iters = 1000\n",
" * flag = 1\n",
" * sol_exacte = [0.5, 1.25, 0.5]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec gct appliqué à fonction 1 au point initial x02 :\u001b[22m\u001b[39m\n",
" * xsol = [0.5000000300375853, 1.2499999849812073, 0.5000000300375854]\n",
" * f(xsol) = 2.2499997296617393\n",
" * nb_iters = 8\n",
" * flag = 0\n",
" * sol_exacte = [0.5, 1.25, 0.5]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec gct appliqué à fonction 2 au point initial x03 :\u001b[22m\u001b[39m\n",
" * xsol = [0.907233957253261, 0.8227554503916317]\n",
" * f(xsol) = 0.008615651265083814\n",
" * nb_iters = 4\n",
" * flag = 0\n",
" * sol_exacte = [0.9072339605110892, 0.82275545631455]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec gct appliqué à fonction 2 au point initial x04 :\u001b[22m\u001b[39m\n",
" * xsol = [0.9072339605126271, 0.8227554563148907]\n",
" * f(xsol) = 0.00861565065977892\n",
" * nb_iters = 1000\n",
" * flag = 1\n",
" * sol_exacte = [0.9072339605110892, 0.82275545631455]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec cauchy appliqué à fonction 1 au point initial x01 :\u001b[22m\u001b[39m\n",
" * xsol = [0.4999999956586144, 1.2499999999634914, 0.5000000043414368]\n",
" * f(xsol) = 2.2499999999997686\n",
" * nb_iters = 1000\n",
" * flag = 1\n",
" * sol_exacte = [0.5, 1.25, 0.5]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec cauchy appliqué à fonction 1 au point initial x02 :\u001b[22m\u001b[39m\n",
" * xsol = [0.49999641933710837, 1.2499999971272502, 0.5000034061295113]\n",
" * f(xsol) = 2.2500007854246964\n",
" * nb_iters = 145\n",
" * flag = 0\n",
" * sol_exacte = [0.5, 1.25, 0.5]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec cauchy appliqué à fonction 2 au point initial x03 :\u001b[22m\u001b[39m\n",
" * xsol = [0.9072374207695968, 0.8227601833906161]\n",
" * f(xsol) = 0.008615107597605259\n",
" * nb_iters = 5\n",
" * flag = 0\n",
" * sol_exacte = [0.9072339605110892, 0.82275545631455]\n",
"--------------------------------------------------------------------------------\n",
"\u001b[34m\u001b[1mRésultats de : Lagrangien augmenté avec cauchy appliqué à fonction 2 au point initial x04 :\u001b[22m\u001b[39m\n",
" * xsol = [0.9072339604988106, 0.8227554563152789]\n",
" * f(xsol) = 0.00861565066072319\n",
" * nb_iters = 1000\n",
" * flag = 1\n",
" * sol_exacte = [0.9072339605110892, 0.82275545631455]\n",
"\u001b[0m\u001b[1mTest Summary: | \u001b[22m\u001b[32m\u001b[1mPass \u001b[22m\u001b[39m\u001b[36m\u001b[1mTotal\u001b[22m\u001b[39m\n",
"Lagrangien augmenté | \u001b[32m 12 \u001b[39m\u001b[36m 12\u001b[39m\n"
]
}
],
"source": [ "source": [
"# les fonctions de l'annexe D sont dans les tests\n", "# les fonctions de l'annexe D sont dans les tests\n",
"tester_lagrangien_augmente(afficher, Lagrangien_Augmente);" "tester_lagrangien_augmente(afficher, Lagrangien_Augmente);"
@ -584,9 +678,52 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-----------------------------------------\n",
"algo=newton, tau=0.01 \t--> iter=1 fxmin=10.846999054820415 flag=1\n",
"-----------------------------------------\n",
"algo=newton, tau=0.1 \t--> iter=1 fxmin=9.0 flag=1\n",
"-----------------------------------------\n",
"algo=newton, tau=1.0 \t--> iter=1 fxmin=4.280618311533889 flag=1\n",
"-----------------------------------------\n",
"algo=newton, tau=10.0 \t--> iter=1 fxmin=2.4930747922437675 flag=1\n",
"-----------------------------------------\n",
"algo=newton, tau=100.0 \t--> iter=1 fxmin=2.2747065779898863 flag=1\n",
"-----------------------------------------\n",
"algo=newton, tau=1000.0 \t--> iter=1 fxmin=2.252474566763813 flag=1\n",
"-----------------------------------------\n",
"algo=cauchy, tau=0.01 \t--> iter=1 fxmin=5.687355025210377 flag=1\n",
"-----------------------------------------\n",
"algo=cauchy, tau=0.1 \t--> iter=1 fxmin=5.687355025210377 flag=1\n",
"-----------------------------------------\n",
"algo=cauchy, tau=1.0 \t--> iter=1 fxmin=5.687355025210377 flag=1\n",
"-----------------------------------------\n",
"algo=cauchy, tau=10.0 \t--> iter=1 fxmin=5.687355025210377 flag=1\n",
"-----------------------------------------\n",
"algo=cauchy, tau=100.0 \t--> iter=1 fxmin=5.687355025210377 flag=1\n",
"-----------------------------------------\n",
"algo=cauchy, tau=1000.0 \t--> iter=1 fxmin=5.687355025210377 flag=1\n",
"-----------------------------------------\n",
"algo=gct, tau=0.01 \t--> iter=1 fxmin=10.846999054820412 flag=1\n",
"-----------------------------------------\n",
"algo=gct, tau=0.1 \t--> iter=1 fxmin=9.0 flag=1\n",
"-----------------------------------------\n",
"algo=gct, tau=1.0 \t--> iter=1 fxmin=4.280618311533889 flag=1\n",
"-----------------------------------------\n",
"algo=gct, tau=10.0 \t--> iter=1 fxmin=2.4930747922437666 flag=1\n",
"-----------------------------------------\n",
"algo=gct, tau=100.0 \t--> iter=1 fxmin=2.274706577989887 flag=1\n",
"-----------------------------------------\n",
"algo=gct, tau=1000.0 \t--> iter=1 fxmin=2.2524745667633006 flag=1\n"
]
}
],
"source": [ "source": [
"for algo in [\"newton\" \"cauchy\" \"gct\"]\n", "for algo in [\"newton\" \"cauchy\" \"gct\"]\n",
" for tau in [0.01; 0.1; 1; 10; 100; 1000]\n", " for tau in [0.01; 0.1; 1; 10; 100; 1000]\n",