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

采纳的回答

Walter Roberson
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
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
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 CenterFile Exchange 中查找有关 Get Started with MuPAD 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by