Ask Your Question
1

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

asked 2015-03-01 00:27:40 +0200

Ricky gravatar image

updated 2015-03-01 01:34:07 +0200

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-03-01 00:41:06 +0200

vdelecroix gravatar image

updated 2015-03-01 01:43:19 +0200

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-03-01 01:44:13 +0200 )edit
1

Good on sage for not leaving radicals in the denominator.

Ricky gravatar imageRicky ( 2015-03-01 01:46:48 +0200 )edit

Great that you got it!

vdelecroix gravatar imagevdelecroix ( 2015-03-01 01:51:51 +0200 )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-03-01 00:27:40 +0200

Seen: 408 times

Last updated: Mar 01 '15