MATLAB: Does the RSUMS function from the Symbolic Math Toolbox return an incorrect result when I specify a range over which to integrate
incorrectrangersumsstepsizeSymbolic Math Toolbox
If I call the RSUMS function using the syntax:
syms x
rsums(x, 0, 10)
I receive a value of 5, which is incorrect. The value should be 50.
Best Answer
This bug has been fixed for Release 14 (R14). For previous releases, please read below for any possible workarounds:
This has been verified as a bug within the RSUMS function in the Symbolic Math Toolbox when called with an integration range. This bug has been fixed in the Symbolic Math Toolbox 3.1 (R14).
As a workaround, replace line 37 of the file :
$MATLAB\toolbox\symbolic\rsums.m
(where $MATLAB is your MATLAB root directory) with the following line:
r = (b-a)*sum(y)/n;
Then, execute the following command at the MATLAB prompt:
This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
This has been verified as a bug within MATLAB 7.0 (R14) in the way some functions that are overloaded for char inputs convert the inputs to double precision values rather than symbolic expressions.
Currently, to work around this issue, convert your char expressions to symbolic expressions prior to supplying them to the DIFF function.
Best Answer