how to perform symbolic factorial ?

I am trying to generate symbolic sums that represent, say, taylor series of some function. This series includes a factorial term but I have been unable to implement it. I may have something like: syms x n f=1/(1-x^4) f2=symsum((1/factorial(n))*f^(n),n,0,10) where f^(n) is the "nth" derivative of f. "factorial(n)" is a placeholder to illustrate what I am trying to accomplish. Any advice would be greatly appreciated. By the way, I am aware of the "Taylor" function. The above example was used to point out my problem area.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 7 de Mzo. de 2011

0 votos

The MuPad factorial function name is fact() . This does not, however, appear to be exposed at the Matlab level, so you might need to use, (e.g.,)
f2=symsum((1/sym('factorial(n)'))*f^(n),n,0,10)

3 comentarios

Walter Roberson
Walter Roberson el 11 de Mzo. de 2011
That should probably have read
f2=symsum((1/sym('fact(n)'))*f^(n),n,0,10)
Getting myself confused because Maple calls it factorial()
Walter Roberson
Walter Roberson el 25 de Mzo. de 2011
Good question. It's a mystery to me as to why there were multiple copies of my comment!
Andrew Newell
Andrew Newell el 25 de Mzo. de 2011
What question? ;)

Iniciar sesión para comentar.

Más respuestas (1)

Andrew Newell
Andrew Newell el 7 de Mzo. de 2011

0 votos

You can use
gamma(n+1)
to get n factorial. Gamma is a generalization of factorial to real numbers.
(edited to apply Walter's correction)

4 comentarios

Walter Roberson
Walter Roberson el 7 de Mzo. de 2011
Small correction: gamma(n+1)
Andrew Newell
Andrew Newell el 8 de Mzo. de 2011
Thanks, @Walter.
Frank DiJoseph
Frank DiJoseph el 10 de Mzo. de 2011
I will try both responses. Thanks very much!
Frank DiJoseph
Frank DiJoseph el 10 de Mzo. de 2011
Thanks very much - this works also!

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by