Ask Your Question
1

dividing vector(a,b) by sqrt(x) gives (a/x*sqrt(x),b/x*sqrt(x))

asked 2015-02-28 17:27:40 -0500

Ricky gravatar image

updated 2015-02-28 18:34:07 -0500

I can't seem to figure out why the behavior above is happening.

I have been trying to familiarize myself with Sage as I am both an IT person at my university and currently a Calc III student and it would seem to me to be helpful for both to know how this software works since many professors use it and I can use it to check work in my classes.

When I attempt to get the unit vector in the direction of <1,1> I divide the vector by its magnitude, and instead of the expected result of <1/sqrt(2), 1/sqrt(2)> I have been getting <1/2*sqrt(2), 1/2*sqrt(2)> and this happens the same way with a vector divided by the sqrt of anything. (i.e. <1,1> / sqrt(3) == <1/3*sqrt(3), 1/3*sqrt(3)>)

Is this a bug, or am I missing something?

EDIT - To clarify, I am dividing a vector by it's magnitude, which is a scalar number. vector{a,b} divded by c should yield vector{a/c, b/c}. This works fine for integers. but when doing so with the sqrt() function it produces odd results. So if c == sqrt(d) the answer is coming back as vector{a/(dc), b/(dc)} and I don't understand why the denominator is being multiplied by d.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-02-28 17:41:06 -0500

updated 2015-02-28 18:43:19 -0500

Hello,

This is just a problem of display. The quantity 1 / sqrt(2) is just equal to 1 / 2 * sqrt(2). The latter is just another form of sqrt(2) / 2. And it is equal to the former if you divide both the numerator and the denominator by sqrt(2).

So it is not a bug but the way Sage displays the result.

Note that it also happens for numbers themselves:

sage: 1 / sqrt(2)
1/2*sqrt(2)

Vincent

edit flag offensive delete link more

Comments

Thank you very much for your response.

Ricky gravatar imageRicky ( 2015-02-28 18:44:13 -0500 )edit
1

Good on sage for not leaving radicals in the denominator.

Ricky gravatar imageRicky ( 2015-02-28 18:46:48 -0500 )edit

Great that you got it!

vdelecroix gravatar imagevdelecroix ( 2015-02-28 18:51:51 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-02-28 17:27:40 -0500

Seen: 109 times

Last updated: Feb 28 '15