Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zomart

Math "!" Function

This topic is 5897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey- I''ve been looking at some series (like the trigonometric series) and have been wondering what the "!" means. The series are as follows: cos x = 1 - (x^2/2!) + (x^4/4!) - (x^6/6!) + (x^8/8!) - ... sin x = x - (x^3/3!) + (x^5/5!) - (x^7/7!) + (x^9/9!) - ... (They are infinite) Now, my question is what the "!" means to do. The example comes up with this: 3! = 6 5! = 120 7! = 5040 9! = 362,880 Any help would be appreciated, thanks...

Share this post


Link to post
Share on other sites
Advertisement
The "!" math symbol is the factorial symbol and is recursive. Given n!, the result will be n(n-1)(n-2)...(1). ie. 5! = 5 * 4 * 3 * 2 * 1. and 3! = 3 * 2 * 1.

Share this post


Link to post
Share on other sites
For doing it with decimals like .5, try looking them up on windows calculator and making a table. THe best approximation formula I''ve seen is:

n! = e^(-n) * n^n * sqrt(2 * pi * n)

But htis formula is kind of inaccurate. Also look up the gamma function because n! = gamma(n - 1) (I think). It is pretty high level and I can''t remember it off the top of my head.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The factorial function is something that doesn''t come up in the basic Path-to-Basic-Calculus programs that most high schools follow. The factorial function arises in discrete mathematics and semi-advanced calculus--Taylor/Maclaurin series. While it is a simple function, it is reasonable for high school students to never hear about it. The teachers aren''t at fault, the program is.

If you were referring to high school teachers being inadequate for not covering the Gamma function... well that''s ludicrous. I didn''t learn anything about the Gamma function until I took my first course in Real Analysis, which was my junior year of college.

Share this post


Link to post
Share on other sites
You don''t see Mr. ! too much until you start dealing with Prob. and Stat., because that''s where it''s used most of the time. Maybe in an extended lesson on the Binomial Expansion Theorum, you might see a ! when you learn how to generate Pascal''s Triangle with Combination, but other than that, there are few other instances you will use it.

Share this post


Link to post
Share on other sites
n! = sqrt(2*pi*n)*pow(n/e,n)*exp(s) where

1/(12n+2/5n) < s < 1/12n

just set s = 1/(12n+1/5n) and you get quite accurate results for n! (+-1 )

just to note:
13! is too big to be stored in an integer
127! is too big to be stored in a double (or a normal float, not sure anymore)
so we could simply write a lookuptable for all (int)n
there aren''t that much

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
quote:
It makes me angry how much highschool teachers neglect to teach...


It is rather strange. I have learnt factorials in the primary school firstly, then as base material in secondary school. What is the average in other schools/countries? I was really astonished when I saw that you didn''t learn about them so far.
Btw. you can also calculate bigger factorials as 127!... Once I have also calculated 10000! ) It is really easy to do: just store the used prim-numbers: calculate the prim-dissolve for each individual number (I mean 10=2*5, 11=11...500=2*2*5*5*5...) and add the used prim-numbers to the so-far-calculated prim-numbers...)
To be clearer:
7! = 1 * 2 * 3 * (2*2) * 5 * (2*3) * 7, so it contains four 2-s, two 3-s, one 5 and one 7. It is 2^4 * 3^2 * 5 * 7 which could be stored as: int part[7] = (0,4,2,0,1,0,1)
Although I don''t know how you should use that, this is possible; I just said it as an interesting fact

Cheers!


-- tSG --

Share this post


Link to post
Share on other sites
i don''t say you can''t calc bigger than 127!, but not in doubles..
if you calc >128! in doubles, you get an overflow (doubles can''t store values like 128! anymore..)

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites

This topic is 5897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!