How to compute derivative of product with mupad?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I was wondering how to compute the derivative of the product below in mupad. The expression below is in latex.
\[ L = \prod_{i=1}^{n}\frac{R_i}{1+R_i} \]
Thanks in advance!
Y-L
0 件のコメント
採用された回答
Walter Roberson
2011 年 9 月 16 日
Is R_i indicating the i'th value of R, R(i) in MATLAB notation?
If so, then at the MuPad level, you would want
diff(product(R[i]/(1+R[i]), i = 1 .. n), V)
where V is the variable that you wish to differentiate with respect to.
If you are intending that your R[i] be expressions in a variable and you intend to differentiate with respect to that variable, then
simplify(diff(product(R[i](x)/(1+R[i](x)), i = 1 .. n), x))
Please note that the above is in MuPad language, not MATLAB directly. You would need to evalin(symengine,'....') or something similar to evaluate it at the MATLAB level.
4 件のコメント
Walter Roberson
2011 年 9 月 16 日
Note that it is normal for the derivative of a product to be a sum.
Do you want to compute the partial derivative of L with respect to each of R[1], R[2], and so on??
That would be written as
diff(product(R[i]/(1+R[i]), i = 1 .. n), R[i] $ i = 1 .. n)
and the result simplifies to product(1/(1+R[i])^2, i=1..n)
Walter Roberson
2011 年 9 月 16 日
In the diff() call, the second argument onwards are the variables to compute the partial derivative with respect to
diff(expression,x,y,x)
for example would calculate with respect to x first, then y, then x.
The $ notation above expands to the list R[1], R[2], ... R[n]
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MuPAD についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!