thanks for reply. first method is worked perfectly. But in the second method it says "global name var is not defined". and i want to implement the libraries in the fashion so that i have to pass as minimum as possible arguments. so plz help me.
On Mon, Apr 30, 2012 at 7:37 PM, P Purkayastha <[email protected]> wrote: > > > On Monday, April 30, 2012 8:11:29 PM UTC+8, yogesh wrote: >> >> Hello Sir, >> >> def symmetry(w): >> if(w==w(x=-x,y=-y)): >> print "symmetrical about origin" >> else: >> print "not symmetrical about origin" >> >> if(w==w(x=-x)): >> print "symmetrical about y axis" >> else: >> print "not symmetrical about y axis" >> if(w==w(y=-y)): >> print "symmetrical about x axis" >> else: >> print "not symmetrical about x axis" >> if(w==w(x=y,y=x)): >> print "symmetrical about y=x line" >> else: >> print "not symmetrical about y=x line" >> >> >> var('x y a') >> w=x^2+y^2-a^2 >> >> html("<h2>Find the symmetry of a curve </h2>") >> symmetry(w) >> >> this is our function symmetry. We had included this into our sage test >> copy but when we try to call it from sage command prompt then it gives >> error that "global variable x is not defined" how to resolve this problem >> ??????/ >> >> plz reply asap. We need it very urgent. >> Thanks >> > You can either > 1. pass the variables into your function as in > def symmetry(w, x, y): > > > 2. Declare x and y inside the function: > def symmetry(w): > x, y = var('x y'); > > -- > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org > -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
