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 mean you have to write a*a*a*a when you want the fourth power? You
need the exponentiation operator ** :
>>> for i in range(6):
... print 2 ** i
...
1
2
4
8
16
32
2. Inputing fractions like (a / b) + (c / d), It's tiring work too.
Can it be simplified?
Surely you jest. Can you suggest a simplification, or have you come
across one in some other language?
3. How can i input root?
Fractional exponents give you roots (sorry about the tiring division):
>>> for i in range(1,7):
... print i, 64 ** (1.0/i)
...
1 64.0
2 8.0
3 4.0
4 2.82842712475
5 2.29739670999
6 2.0
thx 4 reading :)
regards
Steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005 http://www.pycon.org/
Steve Holden http://www.holdenweb.com/
--
http://mail.python.org/mailman/listinfo/python-list