MATLAB: How to compute derivative of product with mupad

mupadSymbolic Math Toolbox

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

Best Answer

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.