How to compute derivative of product with mupad?

4 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Walter Roberson
Walter Roberson il 16 Set 2011
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 Commenti
Walter Roberson
Walter Roberson il 16 Set 2011
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 il 16 Set 2011
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]

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by