Restored from previous forum. Originally posted by WolfgangS.
HI !
I know how to use log10/20 but ...
what is the different between log10/20 and log with basis e ?
MFG
:)WolfgangS
Poor math question
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fweil.
...,
When you use a decimal log you get the power of ten to find the initial value. When using the e based log, it is the power of e you use.
It means ie :
e.f = 2.71828
x.f = 12345
Debug Log(e)
Debug Log10(e)
Debug Pow(e, Log(x))
Debug Pow(10, Log10(x))
Does it help ?
KRgrds
Francois Weil
14, rue Douer
F64100 Bayonne
...,
When you use a decimal log you get the power of ten to find the initial value. When using the e based log, it is the power of e you use.
It means ie :
e.f = 2.71828
x.f = 12345
Debug Log(e)
Debug Log10(e)
Debug Pow(e, Log(x))
Debug Pow(10, Log10(x))
Does it help ?
KRgrds
Francois Weil
14, rue Douer
F64100 Bayonne
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fweil.
Finally ... I suppose it is not to teach anything but I guess it is interesting to know a bit more about e constant.
Here is how to calculate e, based on Euler's sequence using factorial (here coded as a recursive function). Note that I use integers which means you have a poor range limitation (but today's Purebasic floats range is not better anyway).
Procedure.l fact(x.l)
If x > 1
ProcedureReturn x * fact(x - 1)
Else
ProcedureReturn 1
EndIf
EndProcedure
For i = 0 To 15
e.f = 0
For j = 0 To i
e = e + 1/fact(j)
Next
Debug "recurring " + Str(i) + " times : e=" + StrF(e)
Next
Francois Weil
14, rue Douer
F64100 Bayonne
Finally ... I suppose it is not to teach anything but I guess it is interesting to know a bit more about e constant.
Here is how to calculate e, based on Euler's sequence using factorial (here coded as a recursive function). Note that I use integers which means you have a poor range limitation (but today's Purebasic floats range is not better anyway).
Procedure.l fact(x.l)
If x > 1
ProcedureReturn x * fact(x - 1)
Else
ProcedureReturn 1
EndIf
EndProcedure
For i = 0 To 15
e.f = 0
For j = 0 To i
e = e + 1/fact(j)
Next
Debug "recurring " + Str(i) + " times : e=" + StrF(e)
Next
Francois Weil
14, rue Douer
F64100 Bayonne