1 | initial version |

Your `proj`

is `ab.dot_product(n)/n.norm()^2*n`

so your `tt*n.norm()`

is `ab.dot_product(n)/n.norm()^2 * n.norm()`

which is different from `proj.norm()`

because the `norm()`

in `tt*n.norm()`

only applies to `n`

. You made the same mistake when you equaled `(tt*n.norm()).simplify_rational()`

and `tt*n.norm().simplify_rational()`

. Here in the latter the `simplify_rational()`

only applies to `n.norm()`

.

Operator precedence in Sage closely follows the same in Python (but in C++ for example the dot would have behaved the same way.

2 | No.2 Revision |

Your `proj`

is `ab.dot_product(n)/n.norm()^2*n`

so your `tt*n.norm()`

is `ab.dot_product(n)/n.norm()^2 * n.norm()`

which is different from `proj.norm()`

because the `norm()`

in `tt*n.norm()`

only applies to `n`

. You made the same mistake when you equaled `(tt*n.norm()).simplify_rational()`

and `tt*n.norm().simplify_rational()`

. Here in the latter the `simplify_rational()`

only applies to `n.norm()`

.

Operator precedence in Sage closely follows the same in Python (but in C++ for example the dot would have behaved the same ~~way.~~way).

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.