Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercice 3 lab 2 #39

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[deps]
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Binary file added lab1/.DS_Store
Binary file not shown.
195 changes: 160 additions & 35 deletions lab1/notebook_0.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"valeur de r : 4//5 || type de r : Rational{Int64}\n"
]
},
{
"data": {
"text/plain": [
"22//15"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"r = 4//5\n",
"println(\"valeur de r : \", r, \" || type de r : \",typeof(r))\n",
Expand All @@ -160,9 +177,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"valeur de b : true || type de b : Bool\n"
]
}
],
"source": [
"b = true\n",
"println(\"valeur de b : \", b, \" || type de b : \",typeof(b))"
Expand All @@ -177,9 +202,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"valeur de it : 3"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
":2:9 || type de it : StepRange{Int64, Int64}\n"
]
}
],
"source": [
"it = 3:2:9\n",
"println(\"valeur de it : \", it, \" || type de it : \",typeof(it))"
Expand All @@ -194,9 +234,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"('c', 3, \"MTH\")"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"t = tuple('c', 3, \"MTH\")"
]
Expand Down Expand Up @@ -412,9 +462,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"false"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"(1 == 1.) #!= (1 == 1.) "
]
Expand Down Expand Up @@ -556,7 +616,7 @@
"source": [
"N = 4\n",
"i = 0\n",
"while i <= N\n",
"while i ≤ N #<= N\n",
" i += 1 #i = i + 1\n",
" println(i)\n",
"end"
Expand All @@ -571,9 +631,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 27,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello\n"
]
},
{
"data": {
"text/plain": [
"\"hello\""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x = 1\n",
"for i = 1:3\n",
Expand Down Expand Up @@ -662,14 +739,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 30,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"\"bon matin\""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"function f(x)\n",
" return \"bon matin\"\n",
"end\n",
"f(1)"
"f(5)"
]
},
{
Expand All @@ -681,9 +768,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 31,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"\"bon matin\""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"function f(x)\n",
" \"bon matin\"\n",
Expand Down Expand Up @@ -758,9 +855,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 32,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"h (generic function with 2 methods)"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"function h(a::Real, b::Real)\n",
" return a + b\n",
Expand All @@ -773,18 +880,43 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 33,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"# 2 methods for generic function <b>h</b>:<ul><li> h(a::<b>Int64</b>, b::<b>Int64</b>) in Main at <a href=\"https://github.com/tmigot/MTH8408/tree/feb20de68084fdd8adc9d932952b0033cd0e558f//lab1/notebook_0.ipynb#L5\" target=\"_blank\">/Users/pierre-richard/Desktop/MTH8408/lab1/notebook_0.ipynb:5</a></li> <li> h(a::<b>Real</b>, b::<b>Real</b>) in Main at <a href=\"https://github.com/tmigot/MTH8408/tree/feb20de68084fdd8adc9d932952b0033cd0e558f//lab1/notebook_0.ipynb#L1\" target=\"_blank\">/Users/pierre-richard/Desktop/MTH8408/lab1/notebook_0.ipynb:1</a></li> </ul>"
],
"text/plain": [
"# 2 methods for generic function \"h\":\n",
"[1] h(a::Int64, b::Int64) in Main at /Users/pierre-richard/Desktop/MTH8408/lab1/notebook_0.ipynb:5\n",
"[2] h(a::Real, b::Real) in Main at /Users/pierre-richard/Desktop/MTH8408/lab1/notebook_0.ipynb:1"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"methods(h)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 34,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"3.0"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"h(1.,2.)"
]
Expand Down Expand Up @@ -846,13 +978,6 @@
"source": [
"undefined_variable"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -861,15 +986,15 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Julia 1.7.1",
"display_name": "Julia 1.8.5",
"language": "julia",
"name": "julia-1.7"
"name": "julia-1.8"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.7.1"
"version": "1.8.5"
}
},
"nbformat": 4,
Expand Down
7 changes: 0 additions & 7 deletions lab1/notebook_jump.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,6 @@
"\n",
"Et ça sera le sujet du projet !"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading