felix wrote:
> Hello,
>
> When I try:
>
> var('t')
> r=vector((t^2,5*t,t^2-16))
>
> v=derivative(r(t),t)
> norm_v=v.norm()
> print r
> print v
> pos=r(0)
> print pos
> vel=v(0)
>
> i receive an error for the last command vel(0)...i suppose i'm doing
> something wrong ....
> see error below
> Thank you for help...
>
> FG
>
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "_sage_input_33.py", line 14, in <module>
> vel=v(_sage_const_0 )
> File "", line 1, in <module>
>
> File "free_module_element.pyx", line 2023, in
> sage.modules.free_module_element.FreeModuleElement_generic_dense.__call__
> (sage/modules/free_module_element.c:16913)
> File "expression.pyx", line 2957, in
> sage.symbolic.expression.Expression.__call__ (sage/symbolic/
> expression.cpp:14483)
> File "ring.pyx", line 564, in
> sage.symbolic.ring.SymbolicRing._call_element_ (sage/symbolic/ring.cpp:
> 6007)
> ValueError: the number of arguments must be less than or equal to 0
>
The error is that the middle element of v is a number:
sage: v
(2*t, 5, 2*t)
and so your command is equivalent to:
sage: f=SR(5)
sage: f(0)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/jason/.sage/temp/littleone/2729/_home_jason__sage_init_sage_0.py
in <module>()
/home/jason/sage/local/lib/python2.6/site-packages/sage/symbolic/expression.so
in sage.symbolic.expression.Expression.__call__
(sage/symbolic/expression.cpp:14489)()
/home/jason/sage/local/lib/python2.6/site-packages/sage/symbolic/ring.so
in sage.symbolic.ring.SymbolicRing._call_element_
(sage/symbolic/ring.cpp:6007)()
ValueError: the number of arguments must be less than or equal to 0
When working with symbolic things, it's much better to be specific:
sage: v(t=0)
(0, 5, 0)
Ideally, we'd be able to define vector-valued functions:
r(t)=vector(((t^2,5*t,t^2-16))
v(t)=diff(r(t),t)
Then v(0) would make sense, because you've explicitly said that the
first argument is t, so Sage treats v(0) as v(t=0).
Jason
--
Jason Grout
--
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