{ "metadata": { "name": "02_07_more_on_graphing" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Continuing with graphing" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Plotting a function" ] }, { "cell_type": "code", "collapsed": false, "input": [ "def simple_plot_data(fn, xlow, xhigh, xstep=1, yscale=1, yoffset=0) :\n", " \"\"\"This function cooks up data points for a very obnoxious looking graph of the function.\"\"\"\n", " \n", " retval = []\n", " x = xlow\n", " while x < xhigh + xstep :\n", " y = fn(x)\n", " retval.append((x, (y + yoffset) * yscale))\n", " x += xstep\n", " return retval" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "To try it out :" ] }, { "cell_type": "code", "collapsed": false, "input": [ "simple_plot_data(lambda x : x*x, 0, 10)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "pyout", "prompt_number": 2, "text": [ "[(0, 0),\n", " (1, 1),\n", " (2, 4),\n", " (3, 9),\n", " (4, 16),\n", " (5, 25),\n", " (6, 36),\n", " (7, 49),\n", " (8, 64),\n", " (9, 81),\n", " (10, 100)]" ] } ], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "simple_plot_data(fn=lambda x : x*x*x, xlow=-10, xhigh=10, xstep=2, yscale=0.04, yoffset=1000)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "pyout", "prompt_number": 3, "text": [ "[(-10, 0.0),\n", " (-8, 19.52),\n", " (-6, 31.36),\n", " (-4, 37.44),\n", " (-2, 39.68),\n", " (0, 40.0),\n", " (2, 40.32),\n", " (4, 42.56),\n", " (6, 48.64),\n", " (8, 60.480000000000004),\n", " (10, 80.0)]" ] } ], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "def simple_plot(fn, xlow, xhigh, xstep=1, yscale=1, yoffset=0, debug=0) :\n", " data_pts = simple_plot_data(fn, xlow, xhigh, xstep, yscale, yoffset)\n", " if debug > 0 :\n", " print \"simple_plot :\",\n", " print data_pts\n", " # to print the x-axis\n", " y_is_0 = yoffset * yscale\n", " if debug > 0 :\n", " print \"simple_plot : y_is_0 = %d\" % y_is_0\n", " # list to store the lines\n", " plot_list = []\n", " for (x, y) in data_pts :\n", " # String to store the line\n", " str_line = \"\"\n", " for i in range(max(int(y_is_0)+1, int(y)+1)) : \n", " # The +1 is so that those points do get included\n", " if i == int(y) or i == y_is_0 :\n", " str_line += \"*\"\n", " else :\n", " str_line += \" \"\n", " if debug > 0 :\n", " print \"simple_plot : %s\" % str_line\n", " plot_list.append(str_line)\n", " return plot_list" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let us test this" ] }, { "cell_type": "code", "collapsed": false, "input": [ "for line in simple_plot(lambda x : x*x*x, -100, 100, xstep=10, yscale=.00004,yoffset=1000000) :\n", " print line\n", " " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "* *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " **\n", " **\n", " *\n", " *\n", " *\n", " **\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n" ] } ], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "for line in simple_plot(math.sin, -math.pi, math.pi, math.pi/10, yscale=20, yoffset=1.5) :\n", " print line" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " **\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " * *\n", " *\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Plotting loci" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Suppose you want to plot the solutions to the equation, say $x^2 + y^2 = 1$. First we shall convert any such equation to an equation of the form $f(x, y) = 0$. In this case, $f(x, y) = x^2 + y^2 - 1$." ] }, { "cell_type": "code", "collapsed": false, "input": [ "screen = []\n", "xlen = 25\n", "ylen = 40" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [ "def init_screen() :\n", " \"\"\"Initiates the screen. One can also use this to clear the screen. One should use this everytime one changes the size of the screen.\"\"\"\n", " global screen\n", " global xlen\n", " global ylen\n", " \n", " screen = []\n", " for i in range(xlen) :\n", " screen.append([])\n", " for j in range(ylen) :\n", " screen[i].append(' ')\n", " # print screen\n", " # print \"************************************************************\"" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 8 }, { "cell_type": "code", "collapsed": false, "input": [ "init_screen()\n", "print screen" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']]\n" ] } ], "prompt_number": 9 }, { "cell_type": "code", "collapsed": false, "input": [ "def print_screen() :\n", " firstline = True\n", " rule = \" \"\n", " for line in screen :\n", " line_str = \"|\"\n", " for char in line :\n", " line_str += char\n", " if firstline :\n", " rule += \"-\"\n", " line_str += \"|\"\n", " if firstline :\n", " print rule\n", " firstline = False\n", " print line_str\n", " print rule" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 10 }, { "cell_type": "code", "collapsed": false, "input": [ "init_screen()\n", "print_screen()" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " ----------------------------------------\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", " ----------------------------------------\n" ] } ], "prompt_number": 11 }, { "cell_type": "code", "collapsed": false, "input": [ "def print_error(function, warning_type, warning_string) :\n", " \"\"\"warning_types : w, e, i\"\"\"\n", " can_cont = 1\n", " warning_dict = [(\"w\", \"Warning\"),\\\n", " (\"e\", \"Error\"),\\\n", " (\"i\", \"Info\")]\n", " warning_fullform = \"\"\n", " for (s, term) in warning_dict :\n", " if s == warning_type :\n", " warning_fullform = term\n", " if warning_fullform == \"\" :\n", " print \"Error : print_error : Invalid error type.\"\n", " print \"%s : %s : %s\" % (warning_fullform, function, warning_string)\n", " if warning_type == \"w\" or warning_type == \"i\" :\n", " can_cont = 0\n", " return can_cont" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 12 }, { "cell_type": "code", "collapsed": false, "input": [ "def plot(x, y) :\n", " global screen\n", " \n", " cont = 0\n", " if x < 0 or x >= xlen :\n", " cont += print_error(plot, \"e\", \"x out of range\")\n", " if y < 0 or y >= ylen :\n", " cont += print_error(plot, \"e\", \"y out of range\")\n", " if cont == 0 :\n", " screen[x][y] = \"*\"" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 13 }, { "cell_type": "code", "collapsed": false, "input": [ "init_screen()\n", "for i in range(29) :\n", " plot(i, 2*i)\n", "print_screen()" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Error : : y out of range\n", "Error : : y out of range\n", "Error : : y out of range\n", "Error : : y out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", " ----------------------------------------\n", "|* |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", " ----------------------------------------\n" ] } ], "prompt_number": 14 }, { "cell_type": "code", "collapsed": false, "input": [ "def clever_plot(x, y, origx=xlen-1, origy=0) :\n", " cont = 0\n", " x = int(x)\n", " y = int(y)\n", " array_x = origx - y\n", " array_y = origy + x\n", " if array_x < 0 or array_x > xlen - 1 :\n", " cont += print_error(clever_plot, \"e\", \"x out of range\")\n", " if array_y < 0 or array_y > ylen - 1 :\n", " cont += print_error(clever_plot, \"e\", \"y out of range\")\n", " if cont == 0 :\n", " plot(array_x, array_y)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 15 }, { "cell_type": "code", "collapsed": false, "input": [ "for i in range(50) :\n", " clever_plot(i, i)\n", "print_screen()" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", "Error : : x out of range\n", "Error : : y out of range\n", " ----------------------------------------\n", "|* * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "|* |\n", " ----------------------------------------\n" ] } ], "prompt_number": 16 }, { "cell_type": "code", "collapsed": false, "input": [ "init_screen()\n", "for i in range(-5,5) :\n", " clever_plot(i, 1-i, xlen/2, ylen/2)\n", "print_screen()" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " ----------------------------------------\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| * |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", " ----------------------------------------\n" ] } ], "prompt_number": 17 }, { "cell_type": "code", "collapsed": false, "input": [ "def fn_plot(fn, xlow, xhigh, ylow, yhigh, error=.001) :\n", " init_screen()\n", " xscale = float(xhigh - xlow) / ylen\n", " yscale = float(yhigh - ylow) / xlen\n", " for i in range(ylen) :\n", " for j in range(xlen) :\n", " x = (xlow + i * xscale)\n", " y = (ylow + j * yscale)\n", " if abs(fn(x, y)) < error :\n", " clever_plot(i, j)\n", " print_screen()\n", " " ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 18 }, { "cell_type": "code", "collapsed": false, "input": [ "def circle (x, y) :\n", " return x*x + y*y - 1\n", "fn_plot(circle, -2, 2, -2, 2, .122)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " ----------------------------------------\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| ***** |\n", "| ** ** |\n", "| ** ** |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| ** ** |\n", "| ** ** |\n", "| ***** |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", " ----------------------------------------\n" ] } ], "prompt_number": 19 }, { "cell_type": "code", "collapsed": false, "input": [ "def parabola (x, y) :\n", " return (x*x - 4*y)\n", "fn_plot(parabola, -10, 10, -1, 5, .6)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " ----------------------------------------\n", "| |\n", "| |\n", "| |\n", "| * * |\n", "| |\n", "| |\n", "| |\n", "| * * |\n", "| |\n", "| |\n", "| * * |\n", "| * * |\n", "| |\n", "| * * |\n", "| |\n", "| |\n", "| * * |\n", "| * * |\n", "| * * |\n", "| ** ** |\n", "| *** |\n", "| |\n", "| |\n", "| |\n", "| |\n", " ----------------------------------------\n" ] } ], "prompt_number": 20 } ], "metadata": {} } ] }