[sage-support] Re: Norm of real valued vector

2014-04-20 Thread Alberto Verga
You may try:

r, p = var('r', 'p', domain = 'real')
norm( vector([r*cos(p), r*sin(p)]) ).simplify_full()

Le samedi 19 avril 2014 20:53:53 UTC+2, Hadi Lq a écrit :

 Hi everyone

 sage: R.r,p=RR[]
 sage: rvec=vector([r*cos(p),r*sin(p)])
 sage: rr=rvec.norm()
 sage: rr.simplify_full()
 sqrt((abs(cos(p))^2 + abs(sin(p))^2)*abs(r)^2)

 which must gives me: r
 How can I define real valued vector?
 or How can I withdraw abs() function from norm?

 Ubuntu 13.10
 Sage Version 6.1.1, Release Date: 2014-02-04


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Norm of real valued vector

2014-04-20 Thread Alberto Verga
add assume r0

r,p = var('r', 'p', domain='real')
assume(r0)
norm(vector([r*cos(p),r*sin(p)])).simplify_full()

to obtain r

Le samedi 19 avril 2014 20:53:53 UTC+2, Hadi Lq a écrit :

 Hi everyone

 sage: R.r,p=RR[]
 sage: rvec=vector([r*cos(p),r*sin(p)])
 sage: rr=rvec.norm()
 sage: rr.simplify_full()
 sqrt((abs(cos(p))^2 + abs(sin(p))^2)*abs(r)^2)

 which must gives me: r
 How can I define real valued vector?
 or How can I withdraw abs() function from norm?

 Ubuntu 13.10
 Sage Version 6.1.1, Release Date: 2014-02-04


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.