Result of symbolic definite integral is clearly wrong
The plot of the rather complicated function B(t,d) seems correct (see figure 1).
The plot of its definite integral from 0 to t (in the case d=0) is incorrect (see figure 2). It should have constant value 1 on the interval [1,2], but the plot indicates a constant value of 0 on that interval.
What is going on? Did I misuse the symbolic math functions?
PS Both plots look correct for integers d>1.
syms t k d;
cutoff(t) = piecewise(t < 0, 0, t >= 0, t);
parity(k) = 1-2*mod(k,2);
f(t,k,d) = 1/factorial(d)*parity(k)*nchoosek(d+1, k)*cutoff(t-k)^d;
B(t,d) = symsum(f,k,0,floor(t));
IB(t,d) = int(B(t,d),0,t);
bad_d=0;
figure(1)
fplot(B(t,bad_d), [-1,2], ‘LineWidth’, 2);
figure(2)
fplot(IB(t,bad_d), [-1,2], ‘LineWidth’, 2);The plot of the rather complicated function B(t,d) seems correct (see figure 1).
The plot of its definite integral from 0 to t (in the case d=0) is incorrect (see figure 2). It should have constant value 1 on the interval [1,2], but the plot indicates a constant value of 0 on that interval.
What is going on? Did I misuse the symbolic math functions?
PS Both plots look correct for integers d>1.
syms t k d;
cutoff(t) = piecewise(t < 0, 0, t >= 0, t);
parity(k) = 1-2*mod(k,2);
f(t,k,d) = 1/factorial(d)*parity(k)*nchoosek(d+1, k)*cutoff(t-k)^d;
B(t,d) = symsum(f,k,0,floor(t));
IB(t,d) = int(B(t,d),0,t);
bad_d=0;
figure(1)
fplot(B(t,bad_d), [-1,2], ‘LineWidth’, 2);
figure(2)
fplot(IB(t,bad_d), [-1,2], ‘LineWidth’, 2); The plot of the rather complicated function B(t,d) seems correct (see figure 1).
The plot of its definite integral from 0 to t (in the case d=0) is incorrect (see figure 2). It should have constant value 1 on the interval [1,2], but the plot indicates a constant value of 0 on that interval.
What is going on? Did I misuse the symbolic math functions?
PS Both plots look correct for integers d>1.
syms t k d;
cutoff(t) = piecewise(t < 0, 0, t >= 0, t);
parity(k) = 1-2*mod(k,2);
f(t,k,d) = 1/factorial(d)*parity(k)*nchoosek(d+1, k)*cutoff(t-k)^d;
B(t,d) = symsum(f,k,0,floor(t));
IB(t,d) = int(B(t,d),0,t);
bad_d=0;
figure(1)
fplot(B(t,bad_d), [-1,2], ‘LineWidth’, 2);
figure(2)
fplot(IB(t,bad_d), [-1,2], ‘LineWidth’, 2); symbolic math, definite integral, plot MATLAB Answers — New Questions