Skip to content

Commit 1719982

Browse files
committed
Update joint equations tutorial outputs and metadata
Refreshed code cell outputs, execution counts, and execution metadata in the joint_equations.ipynb tutorial. Added print outputs for the second-order system and Jansen-Rit model examples, and updated function signatures and object references to reflect current execution results.
1 parent 32d7df7 commit 1719982

File tree

1 file changed

+65
-44
lines changed

1 file changed

+65
-44
lines changed

docs_classic/tutorial_toolbox/joint_equations.ipynb

Lines changed: 65 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,16 @@
2424
"id": "c9df7780",
2525
"metadata": {},
2626
"source": [
27-
"In a [dynamical system](../tutorial_building/dynamical_systems.ipynb), there may be multiple variables that change dynamically over time. Sometimes these variables are interconnected, and updating one variable requires others as the input. For example, in the widely known Hodgkin\u2013Huxley model, the variables $V$, $m$, $h$, and $n$ are updated synchronously and interdependently (please refer to [Building Neuron Models](../tutorial_building/neuron_models.ipynb)for details). To achieve higher integral accuracy, it is recommended to use ``brainpy.JointEq`` to jointly solving interconnected differential equations."
27+
"In a [dynamical system](../tutorial_building/dynamical_systems.ipynb), there may be multiple variables that change dynamically over time. Sometimes these variables are interconnected, and updating one variable requires others as the input. For example, in the widely known Hodgkin–Huxley model, the variables $V$, $m$, $h$, and $n$ are updated synchronously and interdependently (please refer to [Building Neuron Models](../tutorial_building/neuron_models.ipynb)for details). To achieve higher integral accuracy, it is recommended to use ``brainpy.JointEq`` to jointly solving interconnected differential equations."
2828
]
2929
},
3030
{
3131
"cell_type": "code",
3232
"id": "be08d171",
33-
"metadata": {
34-
"ExecuteTime": {
35-
"end_time": "2025-10-06T05:15:55.420059Z",
36-
"start_time": "2025-10-06T05:15:55.413203Z"
37-
}
38-
},
33+
"metadata": {},
3934
"source": "import brainpy as bp",
4035
"outputs": [],
41-
"execution_count": 9
36+
"execution_count": null
4237
},
4338
{
4439
"cell_type": "markdown",
@@ -61,8 +56,8 @@
6156
"id": "2921b856",
6257
"metadata": {
6358
"ExecuteTime": {
64-
"end_time": "2025-10-06T05:15:55.429070Z",
65-
"start_time": "2025-10-06T05:15:55.423341Z"
59+
"end_time": "2025-11-03T08:47:30.526844Z",
60+
"start_time": "2025-11-03T08:47:30.524677Z"
6661
}
6762
},
6863
"source": [
@@ -71,7 +66,7 @@
7166
"du = lambda u, t, V: a * (b * V - u)"
7267
],
7368
"outputs": [],
74-
"execution_count": 10
69+
"execution_count": 2
7570
},
7671
{
7772
"cell_type": "markdown",
@@ -86,15 +81,15 @@
8681
"id": "08ac3b75",
8782
"metadata": {
8883
"ExecuteTime": {
89-
"end_time": "2025-10-06T05:15:55.435687Z",
90-
"start_time": "2025-10-06T05:15:55.432079Z"
84+
"end_time": "2025-11-03T08:47:36.337738Z",
85+
"start_time": "2025-11-03T08:47:36.334856Z"
9186
}
9287
},
9388
"source": [
9489
"joint_eq = bp.JointEq(dV, du)"
9590
],
9691
"outputs": [],
97-
"execution_count": 11
92+
"execution_count": 3
9893
},
9994
{
10095
"cell_type": "markdown",
@@ -109,15 +104,15 @@
109104
"id": "356cf60d",
110105
"metadata": {
111106
"ExecuteTime": {
112-
"end_time": "2025-10-06T05:15:55.443030Z",
113-
"start_time": "2025-10-06T05:15:55.439434Z"
107+
"end_time": "2025-11-03T08:47:38.014070Z",
108+
"start_time": "2025-11-03T08:47:38.009818Z"
114109
}
115110
},
116111
"source": [
117112
"itg = bp.odeint(joint_eq, method='rk2')"
118113
],
119114
"outputs": [],
120-
"execution_count": 12
115+
"execution_count": 4
121116
},
122117
{
123118
"cell_type": "markdown",
@@ -152,8 +147,8 @@
152147
"id": "4dec7537",
153148
"metadata": {
154149
"ExecuteTime": {
155-
"end_time": "2025-10-06T05:15:55.450726Z",
156-
"start_time": "2025-10-06T05:15:55.447321Z"
150+
"end_time": "2025-11-03T08:47:40.678739Z",
151+
"start_time": "2025-11-03T08:47:40.675701Z"
157152
}
158153
},
159154
"source": [
@@ -165,7 +160,7 @@
165160
"itg_V_u = bp.odeint(diff, method='rk2')"
166161
],
167162
"outputs": [],
168-
"execution_count": 13
163+
"execution_count": 5
169164
},
170165
{
171166
"cell_type": "markdown",
@@ -180,16 +175,16 @@
180175
"id": "12e5d88d",
181176
"metadata": {
182177
"ExecuteTime": {
183-
"end_time": "2025-10-06T05:15:55.460116Z",
184-
"start_time": "2025-10-06T05:15:55.455524Z"
178+
"end_time": "2025-11-03T08:47:42.491024Z",
179+
"start_time": "2025-11-03T08:47:42.487721Z"
185180
}
186181
},
187182
"source": [
188183
"int_V = bp.odeint(dV, method='rk2')\n",
189184
"int_u = bp.odeint(du, method='rk2')"
190185
],
191186
"outputs": [],
192-
"execution_count": 14
187+
"execution_count": 6
193188
},
194189
{
195190
"cell_type": "markdown",
@@ -206,8 +201,8 @@
206201
"id": "38101bec",
207202
"metadata": {
208203
"ExecuteTime": {
209-
"end_time": "2025-10-06T05:15:55.473617Z",
210-
"start_time": "2025-10-06T05:15:55.467195Z"
204+
"end_time": "2025-11-03T08:47:43.649877Z",
205+
"start_time": "2025-11-03T08:47:43.643994Z"
211206
}
212207
},
213208
"source": "bp.odeint(dV, method='rk2', show_code=True)",
@@ -216,30 +211,30 @@
216211
"name": "stdout",
217212
"output_type": "stream",
218213
"text": [
219-
"def brainpy_itg_of_ode10(V, t, u, Iext, dt=0.1):\n",
214+
"def brainpy_itg_of_ode4(V, t, u, Iext, dt=0.1):\n",
220215
" dV_k1 = f(V, t, u, Iext)\n",
221216
" k2_V_arg = V + dt * dV_k1 * 0.6666666666666666\n",
222217
" k2_t_arg = t + dt * 0.6666666666666666\n",
223218
" dV_k2 = f(k2_V_arg, k2_t_arg, u, Iext)\n",
224219
" V_new = V + dV_k1 * dt * 0.25 + dV_k2 * dt * 0.75\n",
225220
" return V_new\n",
226221
"\n",
227-
"{'f': <function <lambda> at 0x0000015BBFC96C00>}\n",
222+
"{'f': <function <lambda> at 0x12ef725c0>}\n",
228223
"\n"
229224
]
230225
},
231226
{
232227
"data": {
233228
"text/plain": [
234-
"<brainpy.integrators.ode.explicit_rk.RK2 at 0x15bbfbdd040>"
229+
"<brainpy.integrators.ode.explicit_rk.RK2 at 0x12ef5e630>"
235230
]
236231
},
237-
"execution_count": 15,
232+
"execution_count": 7,
238233
"metadata": {},
239234
"output_type": "execute_result"
240235
}
241236
],
242-
"execution_count": 15
237+
"execution_count": 7
243238
},
244239
{
245240
"cell_type": "markdown",
@@ -256,8 +251,8 @@
256251
"id": "32901ae6",
257252
"metadata": {
258253
"ExecuteTime": {
259-
"end_time": "2025-10-06T05:15:55.494272Z",
260-
"start_time": "2025-10-06T05:15:55.488118Z"
254+
"end_time": "2025-11-03T08:47:47.051374Z",
255+
"start_time": "2025-11-03T08:47:47.045364Z"
261256
}
262257
},
263258
"source": [
@@ -269,7 +264,7 @@
269264
"name": "stdout",
270265
"output_type": "stream",
271266
"text": [
272-
"def brainpy_itg_of_ode11_joint_eq(V, u, t, Iext, dt=0.1):\n",
267+
"def brainpy_itg_of_ode5_joint_eq(V, u, t, Iext, dt=0.1):\n",
273268
" dV_k1, du_k1 = f(V, u, t, Iext)\n",
274269
" k2_V_arg = V + dt * dV_k1 * 0.6666666666666666\n",
275270
" k2_u_arg = u + dt * du_k1 * 0.6666666666666666\n",
@@ -279,22 +274,22 @@
279274
" u_new = u + du_k1 * dt * 0.25 + du_k2 * dt * 0.75\n",
280275
" return V_new, u_new\n",
281276
"\n",
282-
"{'f': <brainpy.integrators.joint_eq.JointEq object at 0x0000015BBFBDD7F0>}\n",
277+
"{'f': <brainpy.integrators.joint_eq.JointEq object at 0x12ef5e7b0>}\n",
283278
"\n"
284279
]
285280
},
286281
{
287282
"data": {
288283
"text/plain": [
289-
"<brainpy.integrators.ode.explicit_rk.RK2 at 0x15bbfbdd790>"
284+
"<brainpy.integrators.ode.explicit_rk.RK2 at 0x12ef5e3f0>"
290285
]
291286
},
292-
"execution_count": 16,
287+
"execution_count": 8,
293288
"metadata": {},
294289
"output_type": "execute_result"
295290
}
296291
],
297-
"execution_count": 16
292+
"execution_count": 8
298293
},
299294
{
300295
"cell_type": "markdown",
@@ -340,7 +335,12 @@
340335
{
341336
"cell_type": "code",
342337
"id": "second_order_code",
343-
"metadata": {},
338+
"metadata": {
339+
"ExecuteTime": {
340+
"end_time": "2025-11-03T08:47:50.381208Z",
341+
"start_time": "2025-11-03T08:47:50.377324Z"
342+
}
343+
},
344344
"source": [
345345
"import brainpy as bp\n",
346346
"import brainpy.math as bm\n",
@@ -364,8 +364,16 @@
364364
"joint_eq = bp.JointEq(dx, dv)\n",
365365
"print(f\"Joint equation signature: {joint_eq.__signature__}\")"
366366
],
367-
"outputs": [],
368-
"execution_count": null
367+
"outputs": [
368+
{
369+
"name": "stdout",
370+
"output_type": "stream",
371+
"text": [
372+
"Joint equation signature: (x, v, t)\n"
373+
]
374+
}
375+
],
376+
"execution_count": 9
369377
},
370378
{
371379
"cell_type": "markdown",
@@ -411,7 +419,12 @@
411419
{
412420
"cell_type": "code",
413421
"id": "jansen_rit_code",
414-
"metadata": {},
422+
"metadata": {
423+
"ExecuteTime": {
424+
"end_time": "2025-11-03T08:47:55.398154Z",
425+
"start_time": "2025-11-03T08:47:55.348911Z"
426+
}
427+
},
415428
"source": [
416429
"class JansenRitModel(bp.dyn.NeuDyn):\n",
417430
" def __init__(self, size=1, A=3.25, te=10, B=22, ti=20, C=135, \n",
@@ -476,8 +489,16 @@
476489
"model = JansenRitModel(size=1)\n",
477490
"print(\"Jansen-Rit model created successfully!\")"
478491
],
479-
"outputs": [],
480-
"execution_count": null
492+
"outputs": [
493+
{
494+
"name": "stdout",
495+
"output_type": "stream",
496+
"text": [
497+
"Jansen-Rit model created successfully!\n"
498+
]
499+
}
500+
],
501+
"execution_count": 10
481502
},
482503
{
483504
"cell_type": "markdown",
@@ -511,4 +532,4 @@
511532
},
512533
"nbformat": 4,
513534
"nbformat_minor": 5
514-
}
535+
}

0 commit comments

Comments
 (0)