How to write factorial in matlab

  • Context: MATLAB 
  • Thread starter Thread starter adnan jahan
  • Start date Start date
  • Tags Tags
    Factorial Matlab
Click For Summary

Discussion Overview

The discussion revolves around how to compute the factorial of rational numbers in MATLAB, particularly focusing on the limitations of the built-in factorial function for non-integer values.

Discussion Character

  • Technical explanation, Homework-related

Main Points Raised

  • One participant seeks guidance on calculating the factorial of rational numbers in MATLAB, noting that the standard factorial function only works for integers.
  • Another participant suggests exploring the integral formulation of the factorial function and mentions the use of Gauss-Laguerre polynomials as a potential method for programming this in MATLAB.
  • A third participant reiterates the need for a specific function to compute the factorial for a rational number, asking for an example to better understand its implementation.
  • One participant recommends looking up the Gamma function, which is often used as a generalization of the factorial function for non-integer values.

Areas of Agreement / Disagreement

Participants do not reach a consensus on a specific solution for calculating factorials of rational numbers, and multiple approaches are suggested without agreement on a definitive method.

Contextual Notes

The discussion does not clarify the assumptions underlying the use of the Gamma function or the integral formulation, nor does it resolve the specific implementation details in MATLAB.

adnan jahan
Messages
93
Reaction score
0
Dear Fellows,

I want to write rational numbers factorial in my MATLAB program

for integers factorial command is

factorial(n)

but for rational numbers such as 0.1 or 0.2
this command is not working can anyone guide me to solve this issue ?

Regards
 
Physics news on Phys.org
Have you tried to find the integral formulation of the factorial function... from there it should be fairly easy to program it in using Gauss-Laguerre polynomials...
 
Yess I found function for Integer that is ,
for n=8
factorial(8)
but I need for any (0.1)
can you please write it here so that I can understand and use
 
Lookup the Gamma function
 

Similar threads

Replies
6
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
1
Views
2K