On 11/10/10 10:50 AM, stustd wrote:
I try to compute the following inner product:

c(a,b) = a * b                # inner product between a and b
pp(p1,p2) = (p1,p2)       # vec1 with symbolic expressions
ps(s1,s2) = (s1,s2)        # vec2 with symbolic expressions
pp*ps                           # WORKS! (Inner product)
c(pp,ps)                        # DOESN'T WORK!

where pp and ps are shorthand notations for VectorSpace(SF,2):
symbolic fields (SF) with dimension 2. I don't know why the c(pp,ps)
version doesn't work... Help appreciated.


Do:

def c(a,b): return a*b

Then it will work.

The problem is that the symbolic system does not wrap vectors currently. Defining a function using the syntax c(a,b)=a*b defines a symbolic function, which means that (currently) a and b couldn't be vectors. However, using def, we just define a normal python function, so a and b could be anything.

Thanks,

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
URL: http://www.sagemath.org

Reply via email to