Skip to content

Commit

Permalink
Give a simple example of calling solve1d
Browse files Browse the repository at this point in the history
  • Loading branch information
mdpiper committed Aug 11, 2023
1 parent 274762f commit 1d2366c
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion lessons/python/6_functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,44 @@
"\n",
"Documentation systems such as [Sphinx](https://www.sphinx-doc.org/) use docstrings to produce formatted documentation.\n",
"[NumPy](https://numpy.org/doc/1.20/docs/howto_document.html#docstrings) and [Google](https://google.github.io/styleguide/pyguide.html#s3.8.1-comments-in-doc-strings) have style guidelines for docstrings.\n",
"It's a good practice to pick a style and use it consistently."
"It's a good practice to pick a style and use it consistently.\n",
"\n",
"Before we move on, try a simple example of using `solve1d`.\n",
"Start by defining a variable, `z`, to diffuse."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"z = np.zeros(5)\n",
"z[2] = 5\n",
"\n",
"print(z)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now call `solve1d` to diffuse `z` for a given time step and diffusivity."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"solve1d(z, diffusivity=0.25, time_step=0.5)\n",
"\n",
"print(z)"
]
},
{
Expand Down

0 comments on commit 1d2366c

Please sign in to comment.