{
	"cell_id": 5758669193656196492,
	"cells": [
		{
			"cell_id": 10933180705315449745,
			"cell_origin": "client",
			"cell_type": "latex",
			"cells": [
				{
					"cell_id": 8052875440753861004,
					"cell_origin": "client",
					"cell_type": "latex_view",
					"source": "\\package{cdb.graphics.plot}{Plotting of functions}\nFunctionality to make plots of functions."
				}
			],
			"hidden": true,
			"source": "\\package{cdb.graphics.plot}{Plotting of functions}\nFunctionality to make plots of functions."
		},
		{
			"cell_id": 2143692495722213309,
			"cell_origin": "client",
			"cell_type": "input",
			"source": "import numpy as np\nimport matplotlib.pyplot as plt"
		},
		{
			"cell_id": 13829488039530744102,
			"cell_origin": "client",
			"cell_type": "latex",
			"cells": [
				{
					"cell_id": 3811781181886918783,
					"cell_origin": "client",
					"cell_type": "latex_view",
					"source": "\\algorithm{plot(ex: Ex, range: tuple) -> plot}{Plot a function of one variable given the range.}\n\nThe function should be a Cadabra expression (so written using dollar symbols if it is constructed \ninline). The range is a tuple or list with three elements: the symbol which is the \ndependent variable as a Cadabra expression, the starting value and the end value."
				}
			],
			"hidden": true,
			"source": "\\algorithm{plot(ex: Ex, range: tuple) -> plot}{Plot a function of one variable given the range.}\n\nThe function should be a Cadabra expression (so written using dollar symbols if it is constructed \ninline). The range is a tuple or list with three elements: the symbol which is the \ndependent variable as a Cadabra expression, the starting value and the end value."
		},
		{
			"cell_id": 8859335912767278792,
			"cell_origin": "client",
			"cell_type": "input",
			"source": "def plot(fn, range_):\n   r = np.linspace(range_[1], range_[2], 100)\n   fv = np.array(nevaluate(fn, {range_[0]: r}))\n   return plt.plot( r, fv )"
		},
		{
			"cell_id": 8913425743399961136,
			"cell_origin": "client",
			"cell_type": "input",
			"cells": [
				{
					"cell_id": 4740410919831780448,
					"cell_origin": "server",
					"cell_type": "image_png",
					"source": "[encoded data, 20604 characters]"
				},
				{
					"cell_id": 11298695182542396152,
					"cell_origin": "server",
					"cell_type": "latex_view",
					"source": "{}$\\big[$$\\big]$"
				}
			],
			"ignore_on_import": true,
			"source": "plot($\\cos(x)*\\exp(-x**2/5)$, ($x$, 0, 10));"
		},
		{
			"cell_id": 17256249505069699125,
			"cell_origin": "client",
			"cell_type": "latex",
			"cells": [
				{
					"cell_id": 14317927187519933162,
					"cell_origin": "client",
					"cell_type": "latex_view",
					"source": "\\algorithm{plot3d(ex: Ex, range1: tuple, range2: tuple) -> plot}{Plot a function of two variables given their ranges.}\n\nThe function should be a Cadabra expression (so written using dollar symbols if it is constructed \ninline). The ranges is are tuples with three elements each: the symbol which is the \ndependent variable as a Cadabra expression, the starting value and the end value."
				}
			],
			"hidden": true,
			"source": "\\algorithm{plot3d(ex: Ex, range1: tuple, range2: tuple) -> plot}{Plot a function of two variables given their ranges.}\n\nThe function should be a Cadabra expression (so written using dollar symbols if it is constructed \ninline). The ranges is are tuples with three elements each: the symbol which is the \ndependent variable as a Cadabra expression, the starting value and the end value."
		},
		{
			"cell_id": 1072622800111302942,
			"cell_origin": "client",
			"cell_type": "input",
			"source": "def plot3d(fn, range1, range2):\n   r1 = np.linspace(range1[1], range2[2], 100)\n   r2 = np.linspace(range2[1], range2[2], 100)\n   z = np.array( nevaluate(fn, {range1[0]: r1, range2[0]: r2} ) )\n   XV, YV = np.meshgrid(r1, r2)\n   ax = plt.axes(projection='3d')\n   plt.figure().subplots_adjust(top=1, bottom=0, left=0, right=1, wspace=0)\n   ret = ax.plot_surface(XV, YV, z, rstride=1, cstride=1, cmap='terrain', edgecolor=None)\n   return ret "
		},
		{
			"cell_id": 6753832780309258849,
			"cell_origin": "client",
			"cell_type": "input",
			"cells": [
				{
					"cell_id": 2708486498357563597,
					"cell_origin": "server",
					"cell_type": "image_png",
					"source": "[encoded data, 232864 characters]"
				}
			],
			"ignore_on_import": true,
			"source": "plt.clf()\nplot3d( $\\sin(x)\\cos(y)$, ($x$, 0, 12), ($y$, 0, 12));"
		},
		{
			"cell_id": 10075567838808318563,
			"cell_origin": "client",
			"cell_type": "input",
			"source": ""
		}
	],
	"description": "Cadabra JSON notebook format",
	"version": 1.0
}
