This was a pleasant surprise. I discovered it over the weekend. sage: f(x, y, A, B, C) = (A*x + B*y + C == 0)
Having defined general form, you can assign values to the parameters to derive whatever particular equation you might want: sage: f(A=1, B=2, C=3) x + 2*y + 3 == 0 If you assign a value to a parameter, it will be used. If you don't assign a value, the variable will be treated as symbolic. However, no variables need to be explicitly declared as symbolic. You can then isolate variables for different purposes: sage: solve(_, y) [y == -1/2*x - 3/2] sage: example = f(A=3, B=2, C=-4) sage: example 3*x + 2*y - 4 == 0 sage: example(x=0) 2*y - 4 == 0 sage: solve(_,y) [y == 2] sage: example(y=0) 3*x - 4 == 0 sage: solve(_,x) [x == (4/3)] This was very useful for class discussion. We were studying general form of a linear equation. The typical high school textbook treatment of functions leaves kids thinking that functions simply return numeric values, that equations can be expressed in a functional form, but a function that returns an equation? That you just don't see. But the kids could follow this. They thought it was cool. - Michel -- "Computer science is the new mathematics." -- Dr. Christos Papadimitriou --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sage-edu" group. To post to this group, send email to sage-edu@googlegroups.com To unsubscribe from this group, send email to sage-edu+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-edu?hl=en -~----------~----~----~----~------~----~------~--~---