Hi list,
i have a questoin about the handling of (mathematical) functoins in sage.
i have a function
f : k^n \times (k^m)^n -> k for some Field k. with
f(q_1,\dots,q_n,x_1,\dots,x_n) -> \sum\limits_{i=1}^n q_i * x_i
for a given n,m.
and i want to create a family (f_i)_{i=1\dots l} of functions from f where
f_i(q_1,\dots,q_n) = f(q_0,\dots,q_n,x_{i,1},\dots, x_{i,n})
i started with this:
f(q0,q1,q2,q3,x0,x1,x2,x3) = q0 * x0 + q1 * x1 + q2 * x2 + q3 * x3
and a function createFamilyItem(s)
def createFamilyItem(s):
ff(q0,q1,q2,q3) =
f(q0,q1,q2,q3,s.vertices(0),s.vertices(1),s.vertices(2),s.vertices(3))
return ff
but executing createFamilyItem always leads to
TypeError Traceback (most recent call last)
/opt/sage-4.4.3/local/lib/python2.6/site-packages/sage/symbolic/expression.so
in sage.symbolic.expression.Expression.__call__
(sage/symbolic/expression.cpp:15476)()
/opt/sage-4.4.3/local/lib/python2.6/site-packages/sage/symbolic/callable.pyc
in _call_element_(self, _the_element, *args, **kwds)
449 d = dict(zip(map(repr, self.arguments()), args))
450 d.update(kwds)
--> 451 return SR(_the_element.substitute(**d))
452
453
/opt/sage-4.4.3/local/lib/python2.6/site-packages/sage/symbolic/expression.so
in sage.symbolic.expression.Expression.substitute
(sage/symbolic/expression.cpp:14850)()
/opt/sage-4.4.3/local/lib/python2.6/site-packages/sage/symbolic/expression.so
in sage.symbolic.expression.Expression.coerce_in
(sage/symbolic/expression.cpp:10193)()
/opt/sage-4.4.3/local/lib/python2.6/site-packages/sage/structure/parent_old.so
in sage.structure.parent_old.Parent._coerce_
(sage/structure/parent_old.c:3288)()
/opt/sage-4.4.3/local/lib/python2.6/site-packages/sage/structure/parent.so
in sage.structure.parent.Parent.coerce (sage/structure/parent.c:7235)()
TypeError: no canonical coercion from Ambient free module of rank 3 over
the principal ideal domain Integer Ring to Callable function ring with
arguments (q0, x0, q1, x1, q2, x2, q3, x3)
what do i do wrong?
and is there a way to ensure that the x_i are vectors in k^m?
greatz & thnx Johannes
--
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