[Tutor] math description

2012-09-06 Thread damjan kuzmic
Hello,
i would like to know how to write a formula that in excell looks like this:

A / EXP(-LN(2) * t)

-- 
greetings
car kuzma
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] math description

2012-09-06 Thread Mark Lawrence

On 29/08/2012 21:20, damjan kuzmic wrote:

Hello,
i would like to know how to write a formula that in excell looks like this:

A / EXP(-LN(2) * t)



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



Start here http://docs.python.org/tutorial/

--
Cheers.

Mark Lawrence.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] math description

2012-09-06 Thread Alan Gauld

On 29/08/12 21:20, damjan kuzmic wrote:

Hello,
i would like to know how to write a formula that in excell looks like this:

A / EXP(-LN(2) * t)



Start by breaking it down from the inside out.

LN(2) is log(2) in Python, which is found in the math module so you need
import math too.

negation ( -LN() ) and multiplication are builtin (* t)

EXP() is exp(), also in the math module.

division is built in (although I'm not sure if Excel / is integer
or 'real' division, given the nature of the values I'll assume its real...

So the final expression should look like

import math
...
value = A/math.exp(-math.log(2) * t)

Which isn't too different to Excel.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] math description

2012-09-06 Thread Peter Otten
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
 




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor