#### Archived

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

# Math "!" Function

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

## 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 on other sites
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 on other sites
Sweet, thanks man...

##### 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 on other sites
It makes me angry how much highschool teachers neglect to teach...

##### Share on other sites
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 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 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

##### 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 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

##### Share on other sites
The windows calculator is able to calculate and display 5000!, so I wonder what data type it uses if doubles cant even store 127!
Even my TI-92+ can only calculate up to 449!, it treats 450! as infinity.

"I believe; therefore, it is." -True Perception
"The Requested Information Is Unknown Or Classified" -Anonymous

[edited by - Extrarius on May 1, 2002 2:56:10 PM]

##### Share on other sites
davepermen: Indeed, sorry for being false So I change my statement: there is a quite easy way to store even large factorials.

Extrarius: but they round up the results:
5000! = 4.2285779266055435222010642002336e+16325 in windows calculator. That is not a correct result davepermen: double can store precisely 127! ? That is an another interesting question as a factorial should be exact

-- tSG --

##### Share on other sites
well it calculates it as precious as it can..

(and if you use the tailor-series from above, you don''t really care if 127! is now perfectly exact or simply more or less cause dividing by 127! will be small if its now exactly _THE_ value or not

"take a look around" - limp bizkit

##### Share on other sites
Ok, definitely true

-- tSG --

##### Share on other sites
About the highschool teachers neglecting things. That is true, it is the program''s fault and not the teacher''s. I just used that as a general term to say "There is so much more than what the show you". Like when they spit out all these formalus and never explain how or why they work. That bothers me. I always read the book on my own to get an understanding of it, but still, they can do better. I understand that the formulas are going to work every time, but how are you ever going to see to use a formula in a real world problem if you don''t know how it works. I just don''t like following steps they give you. For many problems there are many ways of solving it. I usually like to create my own. The way highschool is taught just bugs me...

##### Share on other sites
quote:
Original post by Zomart
I just don''t like following steps they give you. For many problems there are many ways of solving it. I usually like to create my own. The way highschool is taught just bugs me...

Well, I agree with you. Sadly, you are probably in the minority. I think most high school students want to be handed the answer. Plus, there aren''t really enough teachers to properly deal with the diversity of students...

But, this discussion is more appropriate for the gamedev lounge forum. So I''m closing the thread since the discussion has moved away from math, and because it never was focused on games, .

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

##### Share on other sites

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

This topic is now closed to further replies.