e

Started by
15 comments, last by Spintwo 19 years, 11 months ago
quote:Original post by furby100
The definition I like best is d/dx(e^x) = e^x, i.e. y=e^x has a gradient of e^x.
Using that you can obtain the series Kranar gave with a little bit of brain work.

<SPAN CLASS=editedby>[edited by - furby100 on May 7, 2004 4:40:54 PM]</SPAN>


Obtaining the series involves calculus, not quite for an 8th grader. However it is possible, using basic calculus and a bit of analysis facts (such as logarithms) to derive the series directly from the definition of e, lim n->inf (1+1/n)^n, if you know the general formula for taylor/maclaurin series

The series is converges somewhat fast, the 7 terms Kranar posted will give you 3 decimal places of accuracy - 2.718
Advertisement
Not exactly sure if this helps but since this is on a programming forum, you don''t need to calculate it past a float or a double''s accuracy because your just going to lose it anyways. e is irrational and calculating it is slow. I would just make a double equal to as much of e as it could hold and use that.

If you want a good equation to calculate it to a specific accuracy while hiding all the calculus it is:
e = (1 + 1/x)^x
The higher x is the closer you get to a value for e.

You''re going to have to cut off the accuracy at some point anyways, unless your doing something really advanced which I''m assuming your not since you don''t know calculus yet ; )

Good luck!
well if you recur to infinity would''nt e be infinity?
| Member of UBAAG (Unban aftermath Association of Gamedev)
quote:Original post by Cibressus
well if you recur to infinity would'nt e be infinity?


no because you're adding smaller and smaller numbers:

i.e.

0.9 + 0.09 + 0.009 + 0.0009 + you get the pattern

at infinity will be 1, not inifinity.

-me

[edited by - Palidine on May 10, 2004 11:53:44 PM]
quote:Original post by InTheSackMan
Not exactly sure if this helps but since this is on a programming forum, you don't need to calculate it past a float or a double's accuracy because your just going to lose it anyways. e is irrational and calculating it is slow. I would just make a double equal to as much of e as it could hold and use that.

If you want a good equation to calculate it to a specific accuracy while hiding all the calculus it is:
e = (1 + 1/x)^x
The higher x is the closer you get to a value for e.

You're going to have to cut off the accuracy at some point anyways, unless your doing something really advanced which I'm assuming your not since you don't know calculus yet ; )

Good luck!


Either this or the taylor series is useful to calculate e if you want. With the taylor series it's simple to determine if you've achieved the number of decimal places you want though.

If you want to be really picky, you can state that e come from this process:
define ∫ 1->inf dx/x = ln x,
then e is the value for which ln x = 1
all other "definitions" are really results of the true definition
but that's really too picky for game development

in reality, use const double E = 2.718281828 and be done with it
if you need to find e^x in a game(first ask why), then use the taylor series. it's the easiest way to do the power.

EDIT: Not that I prefer or even like this picky definiton at all...see 2 posts down

[edited by - etothex on May 11, 2004 4:49:46 AM]

[edited by - etothex on May 11, 2004 5:27:26 AM]
quote:Original post by etothex
all other "definitions" are really results of the true definition


(Off Topic) What makes you believe this is the true definition? Was it because this is the way you learned it? Was it because this is the first historical definition? We both agree on the fact that this a correct definition. But why should it be the true one?

My preferred definition is e = exp( 1 ). This is a result of your definition as much as your definition is a result of mine.

EDIT : now that I think of it, if you use your definition you must first prove (although it is trivial) that there exists only one real x for which ln x = 1.

Victor Nicollet, INT13 game programmer



[edited by - ToohrVyk on May 11, 2004 5:07:30 AM]
quote:Original post by ToohrVyk
quote:Original post by etothex
all other "definitions" are really results of the true definition


(Off Topic) What makes you believe this is the true definition? Was it because this is the way you learned it? Was it because this is the first historical definition? We both agree on the fact that this a correct definition. But why should it be the true one?

My preferred definition is e = exp( 1 ). This is a result of your definition as much as your definition is a result of mine.


I didn''t mean it was my choice definition or even that I didn''t wish to rip that definition out of textbooks. I was trying to show how people get crotchety about definitions. Maybe I wasn''t clear enough, sorry(should''ve put true in quotes too), but since we essentially agree, maybe we should get back on topic.

BTW, one of my favorite definitions is the taylor series where x=1, because it is easiest to explain and also easy to derive other definitions from it.

BTW#2-I believe the integral of 1/x definition comes from the fact that there''s no simple way to calculate that integral without knowing the derivative of ln x, and some people don''t like that, so they make a "definition" and wrap it up in a clean package. Could be mistaken, though, haven''t gone too far in math.

This topic is closed to new replies.

Advertisement