# REU

## 3118 days ago by jimlb

This worksheet just gives a very short introduction to SAGE.  The first thing to note is that one nice thing about SAGE is that you can type latex directly into it and read it!  For example, we have the equation $E: y^2 = x^3 + 1$.  You can also select the typeset condition above and it will display the answers in latex as well.  Finally, you can copy the latex from SAGE directly into your latex file so you don't have to retype horrible messy answers.

2+2
 $\newcommand{\Bold}{\mathbf{#1}}4$
f(x) = x^2
type(f(x))
 $\newcommand{\Bold}{\mathbf{#1}}\verb||$
f(2)
 $\newcommand{\Bold}{\mathbf{#1}}4$
E1;
 $\newcommand{\Bold}{\mathbf{#1}}y^2 = x^3 + 1$

SAGE is based on the programming language python, so if you are familiar with python SAGE is very easy to use.  You definitely don't have to know anything about python to use SAGE.  One very nice feature is that once you define an object, say a polynomial $f \in \mathbb{Q}[x]$, one can get the possible commands by typing $f$. tab.  We need to declare a variable first.

var('x'); R = QQ[x];R
 $\newcommand{\Bold}{\mathbf{#1}}x$ $\newcommand{\Bold}{\mathbf{#1}}\Bold{Q}[x]$
f = x^3 + 1;f
 $\newcommand{\Bold}{\mathbf{#1}}x^{3} + 1$
f.derivative(x)
 $\newcommand{\Bold}{\mathbf{#1}}3 \, x^{2}$
f.factor()
 $\newcommand{\Bold}{\mathbf{#1}}{\left(x + 1\right)} {\left(x^{2} - x + 1\right)}$
P=plot(f,(0,10));
Q=plot(800,(0,10), color='red');
P+Q  var('x,y,z')
 $\newcommand{\Bold}{\mathbf{#1}}\left(x, y, z\right)$
R=QQ[x,y,z];R
 $\newcommand{\Bold}{\mathbf{#1}}\Bold{Q}[x, y, z]$
I = (x^2 *y, x*(y+z), y^5 * (x-z))*R;I
 $\newcommand{\Bold}{\mathbf{#1}}\left(x^{2} y, x y + x z, x y^{5} - y^{5} z\right)\Bold{Q}[x, y, z]$
I.groebner_basis()
 $\newcommand{\Bold}{\mathbf{#1}}\left[x z^{6}, y^{5} z + x z^{5}, x^{2} z, x y + x z\right]$

As far as I can tell there are no algorithms for SAGBI bases implemented in SAGE, so if you work on that project it might be a good idea to put that on your list of things to do.

I know very little graph theory, so Kirsti will help you more with this (or force me to learn it.)

D = Graph( { 0: , 1: , 2: } )
D.show()  g=graphs.CompleteGraph(5)
g.show()  $\newcommand{\Bold}{\mathbf{#1}}\left(\begin{array}{rrrrr} 0 & 1 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 \\ 1 & 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 1 & 0 \end{array}\right)$
g=graphs.CompleteBipartiteGraph(2, 3)
g.show()  g.bipartite_color()
 $\newcommand{\Bold}{\mathbf{#1}}\left\{0 : 1, 1 : 1, 2 : 0, 3 : 0, 4 : 0\right\}$
D = DiGraph( { 0: , 1: , 2: , 3:} )
D.show()  There are a lot of commands related to elliptic curves implemented in SAGE.

E1=EllipticCurve([0,1]);E1
 $\newcommand{\Bold}{\mathbf{#1}}y^2 = x^3 + 1$
E1.plot()  E1.torsion_subgroup()
 $\newcommand{\Bold}{\mathbf{#1}}\frac{\ZZ}{6\ZZ}$
E1.torsion_polynomial(5)
 $\newcommand{\Bold}{\mathbf{#1}}5 x^{12} + 380 x^{9} - 240 x^{6} - 1600 x^{3} - 256$
E2=EllipticCurve([0,3]);E2
 $\newcommand{\Bold}{\mathbf{#1}}y^2 = x^3 + 3$
E2.rank()
 $\newcommand{\Bold}{\mathbf{#1}}1$
L=E2.lseries()
L(1)
 $\newcommand{\Bold}{\mathbf{#1}}0.000000000000000$
rho=E1.galois_representation()
rho.image_type(2);
 $\newcommand{\Bold}{\mathbf{#1}}\verb|The|\phantom{\verb!x!}\verb|image|\phantom{\verb!x!}\verb|is|\phantom{\verb!x!}\verb|cyclic|\phantom{\verb!x!}\verb|of|\phantom{\verb!x!}\verb|order|\phantom{\verb!x!}\verb|2|\phantom{\verb!x!}\verb|as|\phantom{\verb!x!}\verb|there|\phantom{\verb!x!}\verb|is|\phantom{\verb!x!}\verb|exactly|\phantom{\verb!x!}\verb|one|\phantom{\verb!x!}\verb|rational|\phantom{\verb!x!}\verb|2-torsion|\phantom{\verb!x!}\verb|point.|$
rho.image_type(6);
 Traceback (click to the left of this block for traceback) ... TypeError: p (=6) must be prime. Traceback (most recent call last): File "", line 1, in File "_sage_input_51.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cmhvLmltYWdlX3R5cGUoNik7"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpCKXrkU/___code___.py", line 3, in exec compile(u'rho.image_type(_sage_const_6 ); File "", line 1, in File "/usr/local/sage-5.8/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/gal_reps.py", line 902, in image_type raise TypeError, "p (=%s) must be prime."%p TypeError: p (=6) must be prime.
K.<i>=NumberField(x^2+1);K
 $\newcommand{\Bold}{\mathbf{#1}}\Bold{Q}[i]/(i^{2} + 1)$
i^2
 $\newcommand{\Bold}{\mathbf{#1}}-1$
b=i^3 + 1;
b.parent()
 $\newcommand{\Bold}{\mathbf{#1}}\Bold{Q}[i]/(i^{2} + 1)$
i^2 + 1
 $\newcommand{\Bold}{\mathbf{#1}}0$
E=EllipticCurve([3*i,-5*i]);E
 $\newcommand{\Bold}{\mathbf{#1}}y^2 = x^3 + 3 ix + \left(-5 i\right)$
E.torsion_subgroup()
 $\newcommand{\Bold}{\mathbf{#1}}0$
E.rank()
 $\newcommand{\Bold}{\mathbf{#1}}1$

Programming is done as it is in python.  The thing to remember is indexing starts at 0, not 1!

for i in [1..10]: i^2
 $\newcommand{\Bold}{\mathbf{#1}}1$ $\newcommand{\Bold}{\mathbf{#1}}4$ $\newcommand{\Bold}{\mathbf{#1}}9$ $\newcommand{\Bold}{\mathbf{#1}}16$ $\newcommand{\Bold}{\mathbf{#1}}25$ $\newcommand{\Bold}{\mathbf{#1}}36$ $\newcommand{\Bold}{\mathbf{#1}}49$ $\newcommand{\Bold}{\mathbf{#1}}64$ $\newcommand{\Bold}{\mathbf{#1}}81$ $\newcommand{\Bold}{\mathbf{#1}}100$
for p in primes(10): p
 $\newcommand{\Bold}{\mathbf{#1}}2$ $\newcommand{\Bold}{\mathbf{#1}}3$ $\newcommand{\Bold}{\mathbf{#1}}5$ $\newcommand{\Bold}{\mathbf{#1}}7$
E1;
 $\newcommand{\Bold}{\mathbf{#1}}y^2 = x^3 + 1$
for p in primes(20): E1.ap(p)
 $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}-4$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}2$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}8$
for n in [2..10]: E1.an(n)
 $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}-4$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}0$ $\newcommand{\Bold}{\mathbf{#1}}0$
E2;
 $\newcommand{\Bold}{\mathbf{#1}}y^2 = x^3 + 3$
E2.rank()
 $\newcommand{\Bold}{\mathbf{#1}}1$
E2.torsion_subgroup()
 $\newcommand{\Bold}{\mathbf{#1}}0$
E2.rational_points(bound=20);
 $\newcommand{\Bold}{\mathbf{#1}}\left[\left(0 : 1 : 0\right), \left(1 : -2 : 1\right), \left(1 : 2 : 1\right)\right]$
T=E2.gens();T
 $\newcommand{\Bold}{\mathbf{#1}}\left[\left(1 : 2 : 1\right)\right]$
P=T
for j in [25..35]: j*P
 $\newcommand{\Bold}{\mathbf{#1}}\left(-\frac{1394729730563782267806364955677527101539063394416115006081844971596966165526197822249528425716598128209972903666755919799393633878890142222565790538822626918642547534613058440776694344528583779155384314786070067684723105015577594220881928908229317279}{7577098871292321139282307472105799737692594105931160382860821848098891713875555736410774578049544537823237533080196230264571171762671652251226177513432952459934685199083859362265114697915896294215105099849470573102909625922936142967255128055892500001} : \frac{1141203657141389007671966068051731633118826489389295445691229264934641951632281134174257215872003176200899788092879724828546507218709237796942918889661896069191945920759533455827173836775211884996502473938072017238201907184940733738000472608118239630273520333350617567875609623959461590721466885632325736867641287554874288448590745235127000869450745824008110338776838706519442}{659560185376163648286820935477802078500281554200302773268782296405228204739956605381276120148640844861735608614948447725578907924746920509945559089040706327238729542006671977233814376252007527688316434374760187799192110766978441405430866304635201566458647578719919102042067197840707638082688265292568595413685568224653752992311696092185847964568780016346348270463177588750001} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(-\frac{1477143281093864776324389162419322160156983278043140150898905309383571617762915811133582968997257744356862945779906810855467678870962370106876733915792179074374779672758583901553764133351856362239929386235303792422738530454070288523352682142744533282758979541457673978583}{1933362462720990109482938009532016910165600849816716386538919362860385219500460312100230302716740632914271322320125579489523538894684643328498927646628046557025541725263835453509946767586934101376657269896800939638700206964962244518815400565889358439467795204523139456656} : -\frac{4296165138693221141122223669605935308819446638151640064730710548157465343937783094411563030254977921527188220276729418619592717703409702760448641676541137066216806862042101252263872844842768761556026196265102768669221405702563970943214034543805601161180680362120512477136008501978399736451430755199896112328089253041671736072333039530022297885003235861620919547087522746203708559690727822535664032505711531}{2688251664711734073314384695368338678380284048420288950670559317458618212655487417170369560656537889230130727218039547726086353914113899533837205433074777033600796132999745819624028579352165978434668720344588744738540178596817918596214561570756690682189548496555226522672415357625997463749258164733357512689359697404271820858775052253393337202943167278003240199155424070757279816193431869926256668471082304} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(\frac{6024459097245208211909125674984925594266742041768899874709990869149579410942280756888106962313321733142789078102319541277072327455528085905428130431863645433641500659804960877839018777530376590061292569764112357991774672801782517346210456252679108711708393379515812459766373190919350891970673}{1535092734854373596575226986959154235145087963620893850052485184635481440036243727528201948709150354401929470588054291687423903503563070984422421372340409749150033468593894731772566777687697467031381533180612243341025413109101853454493580037714196882582547253467520727236272352195917554487121} : -\frac{479066538562659228657445621629018237766366807555704191293973129066111869368624452136308746753264206437104513092207499756776167320656868008493967933367482293498978794517555977878626431849430902088006084770926032655131791319558930577356453730522430941101092085269018000031203331749351937399932757116838545610797970962980810764312790154310079763346998242045771251614347015376597561413831103619144299337275333162470442150864501573336384149830}{60145331715349283107040481846984849622020971082837073085743998679485355106219233122183247978034519894775808463836456877750208832347479872560108295599470199059361148154970473625919031935165931208623621668526863977855686422021776554871619011655276535610827277565405329007364345246729426542260645818833865000139424617182504037605028088198157549317620317777475098574751734816126272945511489095418216583356803648686745829487464384340439306919} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(\frac{69702953706635347432823158598710398067014421298330616513205284064630704586894521271790108078330537345903340112729951170500329066937446077242530522743981222705870962415589164266971733432639102461479778828678488142274428394290539031821234395094257597353918951587554965398607077454974476182179226721220891891154819873}{10424537935530852283132696031348644658750907208146442935304830723086234756903695456068544704065538231195207090627379512153427689994155351819314489694289170815340800939232851811664161308038922541037998928142058977510969920082377987387802987229857424691595027264903783204751195538026391286014921557814600598683077184} : \frac{584850799394262243621935531262831146083884911251802072722608970735687799255000764233978326729806500096433745752569672366892769758509191238627180265069010705494484884987523717729575284909849783913762269994868333981408965073763240895343296539304214397566932246397583478680336989286270163500010836438045730366983149578415829063088606490511279430919692794174159827154620597241486981743048121932584473817035367073972848215067065676637608884033070950239955395306179111566300623}{33657760916857404823771809381428872008008268216272400660060821145812754667569916744119263739670140915582086800279691468430601775300975572022125435522988157770912586134910828263696872475389994615450596473213940436509771526569976352257896767134756288607615912656348324141429552806451690591687952302002475165268597331017545108139604608202411886865990566754898324138785629811535313341046637622672658166361513262459720530087758738111116890075579958509927204821782119075850752} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(-\frac{857338904095930227081762938138242883732619807708524374106290434700766190319442966043340209480869035555569520558750263920638029161058967956429602721309946666488648306482977379877602683986657031140960381822657772331131274365933471278951247669672510477290890259526134294604889931011060580411717975039844217664072978520662264876802189642799}{2289067296423156335161205879089896702347416562546764910248498684984899305323308761934518207044129587644507765758937386091451315626727973673423023768247710218159443523205058478010147159474642134179418181333456825054507523153414002739387565932410143618002778920817725967435232341459159097362933688077554745133509438106142534291575120671601} : \frac{5945821591491234009352080927793685967547895850806113176702920996845748648246265042388246397219999613518634351368770198248947536837017740472101872050284946398209429366278437330205464109574160041035535771219031993854571850987860671302733274018200826524047934267952248738531042339552503355674417003217541047144718881343762063864595449378014506000378477361520453806387030507925192093150010787507873707583040924720489897328903293950369991147188200772785513638696993062629193154128665674056056512380917878330998}{3463281883296058061916755217076299958546872556473788402953398227576563419815399185222254795752366662295323121758884256823993149033272787338763298057218818190729346551966168629076974145083597437608921615172138120588466933339993120941088164065072490756767670119183169640983195987934868196255288053728698023494331712491995583279415306204834101359775637137506782558608198969575934084108891900958659194168246031573537015053959037278213912164966556488714661149392779631720822066292789750767873550332284735436151} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(-\frac{553675843477072398612153632256493758496227786474292757049232602990383470761021855378725069399897692790457186388078468452894974811442438004393963903891729540116289114881282416086859856936175666423254602873505829814779233474125814882741274854954069123110128924091238028122545869268568665138256202830585104335202623463861743596312998958896488986247355300837865751}{949670099518019530836249148733925978469146724697017825490265970682517753818929035963089627669402871018497314555712319501164555073495690071932745765662099204436286874308687815034054959578939081115733927191308078570858567387235816443238071426920280808465397149792113351239276531215603407768226996524437524866067013881101530785360391251671762888138326435421290000} : -\frac{1549100752574349042257374309704140579642132736598804387753084907096317848177505805225003985491280980850850881488566404063571690427774585496804339732312514492930158376062154034588411343453409593092088691887533488127242848298056815165276085447002066106950351081303203051208488441717213186061307003627598569736745825463864852279597117745911922065535701564993050960558269271204468698332510006457590758144630131446622461039902902291546965408204270853616363657024858454589376315034974318582004748754901372822178891678951761498518140740590051645557}{925463183809582029592520984587043375943737078383452845096661167307903334432569439433842094080738112647858882626096009629032736334883514477848023573769624790713311454114228815247319160367296181866209717605250125669209204797880838305885155670617677672883962291776500698962756636465559209477393373087264991076890254651989214611516163439345140640502713466150487467329100955489798414096283707413461268510871931248007826998733127203707435555292564618774875303996985787073435491829088346061662449927939347628995524785354903783260812935748617000000} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(\frac{4906122765187092679704420630888022430036433629256424605170941805704051627726735380735714874579765612533205844449648384770459124823850515108704003199965346151156807564814418836134394937255869017483535345004668775998960764922685528266524836042826740955140858874671251026253680913187813570156026064685855377297710348526246767204862873583419668190512309770552859916640120473129381984956801}{987323102230896652300344754315248698739429558025999872712345300385162443608910162716538777620263249083056656366478347716899514138226467747532884573396323345406141119091385752561594671173098939149467178677918205035989694695286836233813624947349709712373556454533665296489106100519092219280482020345906051415504181894347754180231812244142208152040447042782630577336097571944415767862401} : -\frac{10998996419006690909931861025059040347582980240193568324963638734053316747436149185275139137758999491045141554227284786990109448819250431114251933688717966634643850637320357739450183039869607251964260739820187791064596491134799191873107797766318237280036725793860828298218494806466333536495561893193646604315496074310754304076702711131835654410299373704103784450954924374012925661029926253473851071334518233129382258965623030258220396612227163319241870259614198413414004178197455368927059047778599603446250694362195166984151126018109242939796298275190023091887990047834734514498}{981045045183445781552292868526806338098584016269127923975275539121927178680795105678018916209218150379756706465206157192705445364243456721557907152647706102063754506720326252405681481849497392220172523112491213742345244523719376318340499937026814559388728094058703224699140482099535555373144959790347293085374454664505844289249136003348080040004371106690138265490088216618156995017991523023795958234953007815351631848203760024913306925340931339165482842014974014787599610689804023000504260675026888897259030120780009313416155488018662034389926396882576784074740662981087953601} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(\frac{82638213372939926772502855527375572596593880631182642280986728969616860926965522025821711154792753947879337183239386864772846582539715679791106817230908181268737869132795780074536567867731316394341850940061188798006093169496266466517660529073645222432632739007080632092114318579726973403804096613753731604067532383401801368350146764671944126842835894231473922626342560595868266702372298725254019316423206684673}{16170869027233392546990264607757942143219192287249987585033000185305532554148360238239830636342650028131210378741576005530073441265790033145092264419421413539563519447005118700007957247386493582155346301561145064857104435629249138165169459707498548505227996346675096799192110968167820357644187721852483446215293505117120893134436680746798362678505429934543844158970794281648961203588594398069584291216742518784} : \frac{759623855198763899626038396580418799710450607729988176957763331568825002541596063334429049224875873892809775361580017045264732019954812033293149190693106481592323465818792720861440302828213734327662684711407829583619761816768919541081459473084546778483709459161242323711215589110071565707207819832960701480659559733624833592740306948488771679074660767252393710947715071136884408973881413818362726850655395588088527110162587474731160076903441058726313662502838275772734390295935873032365064101324603987335121070462425412547355142105428705692573321241228436670217388819298462226276667735107861046629064235534419045377}{65027946457043898241534219094150103482001007443953359923756298296399092495688910134575624037760350640807502285080685101419144488895854389780992834260550376598755075761371945878394234598352641564151811395884536018384922736505022654305356029959740479981044561799844753585323966188340451072514871194803579319865533954724803723715489139060345619246261219497042225792179214842639888989561132506885258986390679579605350154502079950184158721928704222465343336580761961156941708350677031964595938049980976238427299864105526244556040392741106022135278424380682645764055289167306818941432006760174626063611865677427201277952} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(-\frac{2516217193026042237767663980279425838971963741457645888530091595335295962996502519645174757752401899161256234466899975380839805138317676890088542462747571745572606136322011994036200514648811385203795330128326146262982145919925811268753120691300185869826252480234587057827060802916679805660023879593305356327642431891405218338393354278218437122124683098655848507354424253485089201552955426048598282251630051734382864368971471780979564927}{4474632320856550526842778248098711877615272187443239566914104111149955767101800137247292777477248202740326835507279621697882651790903201490978516193141176045997368633559839017166197881303483887900410644731951499428936702990196807256008308436544951008556380503415613682518807300549822002731014355698582149716498872889343120580102572285905699612881326746516297986834971435043698722512620433787714651044330544639139366740446092223676289921} : \frac{502838646996512094526201121616123030425486667559463904368380729578501806122271469695166036841325870566840727439629800608665619645595594082501187365989955500526564215913530038102508841959036799799171191069333110924870058940669551068932362798085144643956028730387834270128548112112288713930914488420907748809091772453655022708534930557729947812433972235415657103021465393041835766735790067378752009088108092923353182651158452304376961281877566370897906419455260239865699462898921797153252587772925025585986180994706028888801864726203286590310731031276057533078535049946265810417165668836426829090047485863163709008754163183041541004166824104744180889140930}{299320204256089996118390486223842311313234232039858330889724377247841220921054653847473695908405831046532766990378610212032755489945040330773061830471100280525488412495881664863527429517783121392069286141082981368030537470947631074975303683858033731965113076403580729163001738227631689665039388608257518370423504257481522832346357555028966987316154930718541450080145741101796423182535741420940719822124911504651579437007465385511280143848196034584401267219267646810825652133935528480648741256809807629338052720826852622095164889913460036310031908127779132078289042636674043565699807134925728833237443355519667344416150768995821985481373550127840877851969} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(-\frac{1195898344695081540332313686810588102217123415218524903558330853405006703815313211108421679677942772697950376616307156382571593858896505827894803040147237230015514317594508593389974389529948148270391529901615417602872918767736435329763981128002665392593574790673232090452159093874035412167828510333676461979561459581732294856736228170107865025634115733519922584000778988964331559838980180046450314459714451052636349862966263517542565265971231648181386440621602583}{3022223285801591148886182713891183269053466275930493296404859640677264050062048769349870568658761321319401992732699399911636441134192123239715277118130977000161461740804887816991233034955357167678725135598389410370038880998578985886768537228730041277974083537983363498162643531431440934521976377196168324620667590887554938582168045565142721219049244713963867568079276465656756436913121403167679879431790836524089488683037885846734491337090541543383533772208611856} : -\frac{9005726641486140508965196641221737832400471244879539816659828872563228029553358952671253731122153774390423987603883702914446229125368247252645609641022484324209811373481996117344617445445290168711666752806214389480846033246492056722277388047194328579289327798052716309684505194937796965024223304114429333543798371207290384070859485317622112081749988331671049716692772090813679070441637405894678802579920500795225642375663645528966275910694656257574735419640199090257991325446537160009567887858354579614706293298328964571106295629339523785238756646344412201020819024134207117269833126505804915112388633003264212260625165274127326730713973334528446057774059578276893720601315153083976439644577931}{5253997008187384023463871472426800748174591986382270951014217096948835075262170269479245859634617484845263647587453038051705381783652198408988256175162090437846564826375884629772412454586819540608337206789326872214006270516203380898675106267110812492598682580658410291189038721954347800199406251560934593679252698199076133575439583605902252038886813918589167501958586271472495035473276826865675114964855629462117219381120490898713492305628806296851677198574506243630170672397600913524780169824731789106227199173913041964925606874455658275348259682667406036320943712567951000776366652302819414773928943203576289522788147529939995072171632804154502093208980167392608688012632908431355653060242496} : 1\right)$ $\newcommand{\Bold}{\mathbf{#1}}\left(\frac{25754759367432955662309544200103907239947822134388481584709092699825465107871879437622370771498414098262376060201337431478315424544586497331429688783909573890859648269519202961830805486136843825208126900885161375670017054517465002629781221802814634143453591622260468521431947804359144359950473761937565921133928685813333867662114319749595625059863234738070934096962115342599902142038709554152081962471039290419981776493910401450915076550495829058558422586116137637871216069459752762372352721}{3976315552616844582574598560308861894128861944782350234144003151651704190578682121728934458598634252503077306281693416210960114845773335344861426317691513607539656965880433885516256889383158431984528120382866671301904852423289355813972251759107208162096108838587250488916902169481259199269743348105036798885275828258931064837148907422711193373658471091039230137813184661443093602449066984407166410368643655269480993304974952714313788941734400983751378458780143670577013065439013836131698801} : -\frac{4155952116323855980266796701218641176492678054443825551467785687479517763686337095708902483746237192598340771685426310770201730282642063445725589252077296086655680620014115962775685998055381102157408513484873645789436345151853453730276098848453294129663408346342411746950868009241656794206294978215692417845074141750077788405242979260157993197472639033662538539625072161670778491838509688082735257908968419874233099575962366348357416192015784300978921202210908918901780895185009693874884185781589925719926064492511953730301521315157000196888206245054444108620694508511998402291847219217138778564213883757790871682939633018150182256588930016451283250115376183104760253818015753110355859654101093559451542516447226421249051866523496650742}{250738638179917814072223367972637368453004176123028583353176040117395413038601912161562721608459957910884536309255036946860601463026619968279078501467008300876358589366974850959500029451077479502731677010466397513057778353723150263511070054233585562022650142946896246591076273609380935195345194517022586293795914867939506032851944093751514489668209561744702299586944675289920232037447376552691627892549555412211637349731881183215352369690399470752474216832579077003963332693437132184980186302899455702344036862679848014206206548364882530190339651228661039306248128398101458507503992007637071078569054728942890576592476147850874290224503336544237995706143079385043974979697126359605151187087262069694471539712977161132580913291294056951} : 1\right)$

Suppose you needed $5P$ for your write-up.  You can copy it directly from SAGE into latex!

5*P
 $\newcommand{\Bold}{\mathbf{#1}}\left(\frac{3320340721}{4218632401} : \frac{511703877377158}{274004393077351} : 1\right)$

We can also define our own functions in SAGE.

def eucl_dist((a1,b1),(a2,b2)): return N(sqrt((a1-a2)^2 + (b1-b2)^2))
eucl_dist((1,0),(0,0))
 $\newcommand{\Bold}{\mathbf{#1}}1.00000000000000$
eucl_dist((1,1),(0,0))
 $\newcommand{\Bold}{\mathbf{#1}}1.41421356237310$
def eucl_dist((a1,b1,c1),(a2,b2,c2)): return N(sqrt((a1-a2)^2 + (b1-b2)^2 + (c1-c2)^2))

One last fancy example. You can also define an environment where you can interact with the output.

@interact def f(t=(1/4,(1/16,1/8,..,1))): t0 = t x,y,t=var('x,y,t') show([x==(1-t^2)/(1+t^2), y==2*t/(1+t^2)]) t = t0 (x,y) = ((1-t^2)/(1+t^2), 2*t/(1+t^2)) a = 1/3 G = circle((0,0), 1, color='blue', thickness=3) G += arrow((-1-a,-t*a), (x+a,y+t*a), head=2, color='red') G += point((0,t), pointsize=150, color='black', zorder=100) G += point((-1,0), pointsize=150, color='black', zorder=100) G += point((x,y), pointsize=190, color='lightgreen', zorder=100) G += text("$(0, %s)$"%t, (-.3, t+.2), fontsize=16, color='black', zorder=200) G += text(r"$(%s,\,%s)$"%(x,y), (x+.35, y+.25), fontsize=16, color='black', zorder=200) G.show(aspect_ratio=1, ymin=-1.1, ymax=1.6, xmax=2, xmin=-1.3, fontsize=0, figsize=6)

## Click to the left again to hide and once more to show the dynamic interactive window