On Sun, Feb 06, 2005 at 12:26:30PM -0800, administrata wrote:

Hi! I'm programming maths programs.

And I got some questions about mathematical signs.

1. Inputing suqare like a * a, It's too long when I do time-consuming

things. Can it be simplified?

You can write powers with the "**" operator. In this case,

a ** 2

2. Inputing fractions like (a / b) + (c / d), It's tiring work too.

Can it be simplified?

Because of the rules of operator precedence,

a / b + c / d

has the same meaning as the expression you gave.

3. How can i input root?

Assuming that you've already executed

import math

Here are some ways to find the square root of a number:

math.sqrt(4)

4 ** .5

math.pow(4, .5)

Jeff

-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFCBoFaJd01MZaTXX0RAn7rAJwOcK9AjS6/LRgV8iTFxJTvI1tcnQCgl1N2

LwASOyZQxrYZ5dyHqrvkqH8=

=wzmg

-----END PGP SIGNATURE-----