Compute first partial derivatives for a recursive function.

I would like to ask if there is a way to compute the first derivatives of a recursive function.
For example, let say that we have a function f_{i} = w + a * f_{i-1} and we want to compute the first partial derivatives of a function f_{i} with respect to the variables w and a.
It is a simple example and it is cumputed easily. But I would like to know if there is a method when I have a more complicated example.
Thank you in advance.

답변 (1개)

Roger Stafford
Roger Stafford 2014년 1월 1일
I don't see any particular difficulty here. By taking the derivatives of each f_(i) with respect to a or w you obtain another recursive formula. In your particular example you get
df_(i)/da = f_(i-1)+a*df_(i-1)/da
and
df_(i)/dw = 1 + a*df_(i-1)/dw
Each of these can be evaluated by a recursive procedure, (preferably using ordinary for-loops.) Presumably the initial values of df_(1)/da and df_(1)/dw are regarded as zero. If not, you will need to know what they are.

댓글 수: 2

Thanks for your quick response. As I have said this is a simple example and it is computed easily. Let say than f_i = W + A x_i + B f_i-1, where f is a vector kx1, A matrix kxk and B matrix kxk. And you want the first partial derivatives of each parameter. I have found the form of partial derivatives analytically and I have also write a program. What I want to know is if there is a way to do it with a mfile of matlab. I have found that using this http://www.mathworks.com/help/symbolic/jacobian.html you can compute the Jacobian matrix of a vector f when f has not a recursive form. I wondered if there is something similar to this.
Would that be a Markov chain ?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Entering Commands에 대해 자세히 알아보기

질문:

Fio
2014년 1월 1일

댓글:

2014년 1월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by