Hello Sepidar,
in your second example you create functions without a return
statement. Per default Python returns None if the function ends
without an explicit return statement. That is the cause for the
error.
Just define the functions like this:
def n(t):
return cos(a*t),sin(a*t),0
def p(
Now consider this case:
var('x y z t a d')
def n(t):
cos(a*t),sin(a*t),0
def p(t):
d*n(t)[0],d*n(t)[1],d*n(t)[2]
When I try p(0) I get error. Why?
On Jun 19, 10:17 pm, Harald Schilly wrote:
> Functions can have several arguments. For g, you can define a python
> function that returns mu
Thank you for your answer. Actually I just showed my problem
simplified.
On Jun 19, 10:17 pm, Harald Schilly wrote:
> Functions can have several arguments. For g, you can define a python
> function that returns multiple arguments - this is then a tuple that you can
> unwrap with "*". Look careful
Functions can have several arguments. For g, you can define a python
function that returns multiple arguments - this is then a tuple that you can
unwrap with "*". Look carefully at the following session:
sage: var('a b c x y z')
(a, b, c, x, y, z)
sage: f(x,y,z) = a*x^2+b*x+c
sage: f(1,2,3
Hi,
I am new to Sage and excuse me if my question is so simple.
If I understood correctly, a vector in sage can be shown by something
like: [x,y,z]
Now, I want to define a function to get a symbolic vector as parameter
and return a symbolic vector or scalar. Something like:
f([x,y,z])=a*x^2+b*x+
I found out that in Mathematica this can be done by
PolynomialReduce[dT, dt, {t1, t2}]. Output given below.
In[26]:= FullSimplify[PolynomialReduce[dT, dt, {t1, t2}]]
Out[26]= {{1/Sqrt[1 - u^2/c^2]}, (u (x1 - x2))/(c^2 Sqrt[1 - u^2/
c^2])}
But I'd rather use Sage. Does Sage have a counterpart to
Thanks for the replies.
--
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
The following are the expressions,
sage: var('x1,t1,x2,t2,u,c',domain=RR);assume(u>0);assume(c>u);
(x1, t1, x2, t2, u, c)
sage: T1 = (t1-((u*x1)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: T2 = (t2-((u*x2)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: dT = T2-T1
sage: dt = t2-t1
Suppose I know that dT is in this f
I am interested too :-)
https://groups.google.com/d/topic/sage-support/TQt4iQcKCvg/discussion
Nathann
--
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