Hi I would like to write functions that return equations. I would like
to know what the preferred method in SAGE for doing so is.
This is what I have now:
def line_two_points(point1,point2):
r"""
Returns an equation of a line passing through point1 and point2.
EXAMPLES:
sage: line_two_points((3,4),(8,7))
'y = 3/5*x + 11/5'
sage: line_two_points((9,3),(6,7))
'y = -4/3*x + 15'
sage: line_two_points((2,5),(8,9))
'y = 2/3*x + 11/3'
AUTHOR: Timothy Clemans
"""
return "y = %s" %
str((point2[1]-point1[1])/(point2[0]-point1[0])*x +
(point1[1]-(point2[1]-point1[1])/(point2[0]-point1[0])*point1[0]))
I don't want the ' at the beginning and end.
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---