[Tutor] math description

Peter Otten __peter__ at web.de
Thu Sep 6 10:56:15 CEST 2012


damjan kuzmic wrote:

> i would like to know how to write a formula that in excell looks like
> this:
> 
> A / EXP(-LN(2) * t)

>>> import math
>>> A = 1.23
>>> t = 4.56

Literally (math.log is the natural logarithm):
>>> A / math.exp(-math.log(2) * t)
29.013618196288864

However,
    exp(-x) == 1 / exp(x)
and
    exp(ln(a)*x) == a ** x
so you better spell it

>>> A * 2 ** t
29.013618196288864
 






More information about the Tutor mailing list