Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi good folks,

Is there a way to specify a Factorial function in File Maker, such as (Field-1)!

Thank you

Here's the calc:

If((integer = Int(integer)) and (integer > 0),

integer *

If(integer > 1, integer-1, 1) *

If(integer > 2, integer-2, 1) *

If(integer > 3, integer-3, 1),

TextToNum("")

)

Notice that one line repeats, except that the numbers increment. Rather than type each line by hand, create a calc field and as many records as you need to handle your largest factorial. Export the calc to a tab delimited file. Open the file in a text editor, and copy and paste into your factorial calc. Here's the factorial builder calc:

"If(integer > " &

Status(CurrentRecordNumber) &

", integer-" &

Status(CurrentRecordNumber) &

", 1) *"

Try this:

code:


Round(

(x+1) ^ (x+1) * Exp( - (x+1)) * Sqrt(2 * 3.1415926536/(x+1)) *

(

1+

1/(12*(x+1)) +

1/(288*(x+1)^2) -

139/(51840*(x+1)^3) -

571/(2488320*(x+1)^4)

),0)


This is essentially a series expansion of the Gamma function (actually Gamma[x+1]) which is equal to Factorial(x) for integer values.

Make special note of the alternating addition and subtraction of terms in the last 4 lines of the main part of the formula.

[ January 08, 2002: Message edited by: BobWeaver ]

Integer! Could be done with a script, but not a calculation:

If Integer = Truncate(Integer, 0)

Set Field (gCounter, Integer)

Set Field (gFactorial, Integer)

Loop

Set Field (gFactorial, gFactorial*Counter-1)

Set Field (gCounter, gCounter-1)

Exit Loop If (gCounter=1)

End Loop

Else

Show Message ("This number is not an integer.")

End If

  • Author

Thank you all for your help.

Thom, your calc worked like a charm!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.