Maybe this?
sage: V = VectorSpace(SR, 2) sage: x,y = var('x,y') sage: f = V([x+y,x-x*y]) sage: f(2,3) (5, -4) On Thu, Feb 12, 2009 at 5:34 PM, Jason Grout <jason-s...@creativetrax.com> wrote: > > What is the best way to deal with symbolic functions from R^n to R^m? A > symbolic vector? Note some of the following ways that do not work. I'm > not sure how I would specify that a given function f: R^2->R^2, for > example, had input variables x and y (if, say, I wanted to define it > f(x,y)=vector([x-y+c, x+2*c]) ) > > > > sage: var('x,y') > (x, y) > sage: f(x,y)=(x+y,x-2*y) > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > > /home/grout/.sage/temp/good/18016/_home_grout__sage_init_sage_0.py in > <module>() > > /home/grout/sage/local/lib/python2.5/site-packages/sage/calculus/all.pyc > in symbolic_expression(x) > 73 if isinstance(x, Expression): > 74 return x > ---> 75 return SR(x) > 76 > 77 import desolvers > > /home/grout/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.pyc > in __call__(self, x) > 452 msg, s, pos = err.args > 453 raise TypeError, "%s: %s !!! %s" % (msg, > s[:pos], s[pos:]) > --> 454 return self._coerce_impl(x) > 455 > 456 def _coerce_impl(self, x): > > /home/grout/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.pyc > in _coerce_impl(self, x) > 513 return self(x._sage_()) > 514 else: > --> 515 raise TypeError, "cannot coerce type '%s' into a > SymbolicExpression."%type(x) > 516 > 517 def _repr_(self): > > TypeError: cannot coerce type '<type 'tuple'>' into a SymbolicExpression. > sage: f=(x+y,x-2*y) > sage: f(x=2,y=3) > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > > /home/grout/.sage/temp/good/18016/_home_grout__sage_init_sage_0.py in > <module>() > > TypeError: 'tuple' object is not callable > sage: f=vector((x+y,x-2*y)) > sage: f(x=2,y=3) > (5, -4) > > > Jason > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---