From 51c2b6e658092c5232a583c22c03d08706f76c16 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 2 May 2011 17:39:26 -0400 Subject: [PATCH] Add the example1.py sage code. --- doc/example1.py | 100 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 doc/example1.py diff --git a/doc/example1.py b/doc/example1.py new file mode 100644 index 0000000..9dbe06f --- /dev/null +++ b/doc/example1.py @@ -0,0 +1,100 @@ +#!/home/mjo/bin/sage + +# example1.py +# +# In the paper, we display a lot of sage code to be entered at the +# prompt. It's not much fun re-entering all of these formulas every +# time you'd like to work on the paper, so a quick load('example1.py') +# from the sage prompt will pull all of this stuff in for you. +# + +x,y,z = var('x,y,z') + +f = 1 + x + x*y + x*y*z + +g = [[[ f(x=a, y=b, z=c) for a in range(0,3) ] for b in range(0,3) ] for c in range(0,3) ] + +def grid(x,y,z): + return g[z][y][x] + +def I(x,y,z): + return grid(x,y,z) + +def F(x,y,z): + return grid(x-1, y, z) + +def B(x,y,z): + return grid(x+1, y, z) + +def L(x,y,z): + return grid(x, y-1, z) + +def R(x,y,z): + return grid(x, y+1, z) + +def T(x,y,z): + return grid(x, y, z+1) + +def D(x,y,z): + return grid(x, y, z-1) + +def FL(x,y,z): + return grid(x-1, y-1, z) + +def FR(x,y,z): + return grid(x-1, y+1, z) + +def FD(x,y,z): + return grid(x-1, y, z-1) + +def FT(x,y,z): + return grid(x-1, y, z+1) + +def BL(x,y,z): + return grid(x+1, y-1, z) + +def BR(x,y,z): + return grid(x+1, y+1, z) + +def BD(x,y,z): + return grid(x+1, y, z-1) + +def BT(x,y,z): + return grid(x+1, y, z+1) + +def LD(x,y,z): + return grid(x, y-1, z-1) + +def LT(x,y,z): + return grid(x, y-1, z+1) + +def RD(x,y,z): + return grid(x, y+1, z-1) + +def RT(x,y,z): + return grid(x, y+1, z+1) + +def FLD(x,y,z): + return grid(x-1, y-1, z-1) + +def FLT(x,y,z): + return grid(x-1, y-1, z+1) + +def FRD(x,y,z): + return grid(x-1, y+1, z-1) + +def FRT(x,y,z): + return grid(x-1, y+1, z+1) + +def BLD(x,y,z): + return grid(x+1, y-1, z-1) + +def BLT(x,y,z): + return grid(x+1, y-1, z+1) + +def BRD(x,y,z): + return grid(x+1, y+1, z-1) + +def BRT(x,y,z): + return grid(x+1, y+1, z+1) + -- 2.44.2