{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Script to illustrate how to draw direction field with supplied command\n", "#draw_dirfield().\n", "\n", "#Define right side of ODE u' = f(t,u)\n", "def f(t,u):\n", " return t*cos(u) - sin(t)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Load in supplied command for direction fields\n", "load('draw_dirfield.sage')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Construct phase portrait on range 0 <= t <= 5, 0 <= u <= 5.\n", "draw_dirfield(f, [0,5,0,5])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Construct phase portrait with solutions satisfying u(1) = 2, u(2) = 3,\n", "#and u(3) = 1\n", "draw_dirfield(f, [0,5,0,5], [[1,2],[2,3],[3,1]])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SageMath 9.2", "language": "sage", "name": "sagemath" }, "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.7.7" } }, "nbformat": 4, "nbformat_minor": 4 }