Norm of real valued vector

25 views
Skip to first unread message

Hadi Lq

unread,
Apr 19, 2014, 2:53:53 PM4/19/14
to sage-s...@googlegroups.com
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

Alberto Verga

unread,
Apr 20, 2014, 8:11:08 AM4/20/14
to sage-s...@googlegroups.com
You may try:

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

Alberto Verga

unread,
Apr 20, 2014, 8:13:58 AM4/20/14
to sage-s...@googlegroups.com
add assume r>0

r,p = var('r', 'p', domain='real')
assume(r>0)
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 :
Reply all
Reply to author
Forward
0 new messages