Ajouts des questions
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "349bd8d2-2bc8-45e3-9f8a-7d60f7dedd39",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import numpy as np\n",
|
||||
"import matplotlib.pyplot as plt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "885fccca-d36b-4d94-ba40-03eb06df2c57",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def getA():\n",
|
||||
" pass"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.5"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,124 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "fcdc8220-ff32-44a6-a1aa-008c9d2ab047",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import numpy as np\n",
|
||||
"import matplotlib.pyplot as plt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "f6807c1d-c008-4661-a888-5244338ff765",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def f(x):\n",
|
||||
" return x**-2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "b1095809-d35b-475a-887e-728695022470",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def integrNC(fct, a, b, N, m, n, r, coeff, tol=1e10):\n",
|
||||
" h = (b-a)/m/N\n",
|
||||
" I = 0\n",
|
||||
" for k in range(N):\n",
|
||||
" # Ajout d'un shéma élementaire\n",
|
||||
" Ie = 0\n",
|
||||
" \n",
|
||||
" Xk = a + h*k*m\n",
|
||||
" for i in range(n+1):\n",
|
||||
" Ie += coeff[i] * fct(Xk + (i+r)*h)\n",
|
||||
" \n",
|
||||
" I += Ie * h\n",
|
||||
" \n",
|
||||
" return I"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "36508cd9-143a-4174-bc98-6c01634f1fcd",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"0.998686802598624\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"I = 0\n",
|
||||
"a, b = 1, 5\n",
|
||||
"N=100\n",
|
||||
"m=1\n",
|
||||
"n=1\n",
|
||||
"r=0\n",
|
||||
"coeff = [.5, .5]\n",
|
||||
" \n",
|
||||
"while True:\n",
|
||||
" Ie = integrNC(f, a, b, N, m, n, r, coeff)\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" d= b-a\n",
|
||||
" b += d\n",
|
||||
" a += d\n",
|
||||
" # print(I, abs(Ie), abs(Ie)<1e-10)\n",
|
||||
" if abs(I+Ie) - abs(I) < 1e-5:\n",
|
||||
" break\n",
|
||||
" I += Ie\n",
|
||||
" \n",
|
||||
"print(I)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d52567ea-6629-4433-9df9-e3f93de1c36c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.5"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+177
File diff suppressed because one or more lines are too long
+128
File diff suppressed because one or more lines are too long
+162
File diff suppressed because one or more lines are too long
+163
File diff suppressed because one or more lines are too long
+122
File diff suppressed because one or more lines are too long
+174
File diff suppressed because one or more lines are too long
+258
File diff suppressed because one or more lines are too long
+220
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user