Plot of integral of summed `Sinc` series is incorrect
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have curve given by summing a small, finite series of Sinc
functions, and I want to plot both the curve and its integral. In principle, it's easy:
test[x_] := Sinc[Pi*x]^2 + Sinc[Pi*(x - 3)]^2 + Sinc[Pi*(x - 6)]^2 +
Sinc[Pi*(x - 9)]^2 + Sinc[Pi*(x - 12)]^2 + Sinc[Pi*(x - 15)]^2;
sumtest = Integrate[test[x], x];
Plot[test[x], sumtest, x, 0, 15, PlotLegends -> "Expressions"]
...but in practice, it's not working. Since the Sinc
functions are all squared, the curve is necessarily positive at all points for real x
. Therefore, the integral is also always positive. But my plot looks like this:
Can someone tell me what I'm doing wrong - and how to do it right?
plotting calculus-and-analysis trigonometry
 |Â
show 3 more comments
up vote
1
down vote
favorite
I have curve given by summing a small, finite series of Sinc
functions, and I want to plot both the curve and its integral. In principle, it's easy:
test[x_] := Sinc[Pi*x]^2 + Sinc[Pi*(x - 3)]^2 + Sinc[Pi*(x - 6)]^2 +
Sinc[Pi*(x - 9)]^2 + Sinc[Pi*(x - 12)]^2 + Sinc[Pi*(x - 15)]^2;
sumtest = Integrate[test[x], x];
Plot[test[x], sumtest, x, 0, 15, PlotLegends -> "Expressions"]
...but in practice, it's not working. Since the Sinc
functions are all squared, the curve is necessarily positive at all points for real x
. Therefore, the integral is also always positive. But my plot looks like this:
Can someone tell me what I'm doing wrong - and how to do it right?
plotting calculus-and-analysis trigonometry
Integrate[test[x], x]
will give you only one of many possible antiderivatives, and not necessarily the one you want. You need an extra condition that will impose your positivity requirement.
– J. M. is somewhat okay.♦
1 hour ago
OK. How do I do that?
– Richard Burke-Ward
1 hour ago
You seem to be starting from $0$, so try subtracting the result ofLimit[Integrate[test[x], x], x -> 0]
to your integral.
– J. M. is somewhat okay.♦
1 hour ago
Exactly what I needed. Thank you. Want to promote your response to 'answer' so I can tick it?
– Richard Burke-Ward
1 hour ago
If I may: if you understand whatLimit[Integrate[test[x], x], x -> 0]
was supposed to compute, I encourage you to try writing an answer to your own question. :) I can then refine it if needed and maybe even upvote it.
– J. M. is somewhat okay.♦
1 hour ago
 |Â
show 3 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have curve given by summing a small, finite series of Sinc
functions, and I want to plot both the curve and its integral. In principle, it's easy:
test[x_] := Sinc[Pi*x]^2 + Sinc[Pi*(x - 3)]^2 + Sinc[Pi*(x - 6)]^2 +
Sinc[Pi*(x - 9)]^2 + Sinc[Pi*(x - 12)]^2 + Sinc[Pi*(x - 15)]^2;
sumtest = Integrate[test[x], x];
Plot[test[x], sumtest, x, 0, 15, PlotLegends -> "Expressions"]
...but in practice, it's not working. Since the Sinc
functions are all squared, the curve is necessarily positive at all points for real x
. Therefore, the integral is also always positive. But my plot looks like this:
Can someone tell me what I'm doing wrong - and how to do it right?
plotting calculus-and-analysis trigonometry
I have curve given by summing a small, finite series of Sinc
functions, and I want to plot both the curve and its integral. In principle, it's easy:
test[x_] := Sinc[Pi*x]^2 + Sinc[Pi*(x - 3)]^2 + Sinc[Pi*(x - 6)]^2 +
Sinc[Pi*(x - 9)]^2 + Sinc[Pi*(x - 12)]^2 + Sinc[Pi*(x - 15)]^2;
sumtest = Integrate[test[x], x];
Plot[test[x], sumtest, x, 0, 15, PlotLegends -> "Expressions"]
...but in practice, it's not working. Since the Sinc
functions are all squared, the curve is necessarily positive at all points for real x
. Therefore, the integral is also always positive. But my plot looks like this:
Can someone tell me what I'm doing wrong - and how to do it right?
plotting calculus-and-analysis trigonometry
plotting calculus-and-analysis trigonometry
edited 1 hour ago
J. M. is somewhat okay.♦
92.5k10286440
92.5k10286440
asked 1 hour ago
Richard Burke-Ward
3738
3738
Integrate[test[x], x]
will give you only one of many possible antiderivatives, and not necessarily the one you want. You need an extra condition that will impose your positivity requirement.
– J. M. is somewhat okay.♦
1 hour ago
OK. How do I do that?
– Richard Burke-Ward
1 hour ago
You seem to be starting from $0$, so try subtracting the result ofLimit[Integrate[test[x], x], x -> 0]
to your integral.
– J. M. is somewhat okay.♦
1 hour ago
Exactly what I needed. Thank you. Want to promote your response to 'answer' so I can tick it?
– Richard Burke-Ward
1 hour ago
If I may: if you understand whatLimit[Integrate[test[x], x], x -> 0]
was supposed to compute, I encourage you to try writing an answer to your own question. :) I can then refine it if needed and maybe even upvote it.
– J. M. is somewhat okay.♦
1 hour ago
 |Â
show 3 more comments
Integrate[test[x], x]
will give you only one of many possible antiderivatives, and not necessarily the one you want. You need an extra condition that will impose your positivity requirement.
– J. M. is somewhat okay.♦
1 hour ago
OK. How do I do that?
– Richard Burke-Ward
1 hour ago
You seem to be starting from $0$, so try subtracting the result ofLimit[Integrate[test[x], x], x -> 0]
to your integral.
– J. M. is somewhat okay.♦
1 hour ago
Exactly what I needed. Thank you. Want to promote your response to 'answer' so I can tick it?
– Richard Burke-Ward
1 hour ago
If I may: if you understand whatLimit[Integrate[test[x], x], x -> 0]
was supposed to compute, I encourage you to try writing an answer to your own question. :) I can then refine it if needed and maybe even upvote it.
– J. M. is somewhat okay.♦
1 hour ago
Integrate[test[x], x]
will give you only one of many possible antiderivatives, and not necessarily the one you want. You need an extra condition that will impose your positivity requirement.– J. M. is somewhat okay.♦
1 hour ago
Integrate[test[x], x]
will give you only one of many possible antiderivatives, and not necessarily the one you want. You need an extra condition that will impose your positivity requirement.– J. M. is somewhat okay.♦
1 hour ago
OK. How do I do that?
– Richard Burke-Ward
1 hour ago
OK. How do I do that?
– Richard Burke-Ward
1 hour ago
You seem to be starting from $0$, so try subtracting the result of
Limit[Integrate[test[x], x], x -> 0]
to your integral.– J. M. is somewhat okay.♦
1 hour ago
You seem to be starting from $0$, so try subtracting the result of
Limit[Integrate[test[x], x], x -> 0]
to your integral.– J. M. is somewhat okay.♦
1 hour ago
Exactly what I needed. Thank you. Want to promote your response to 'answer' so I can tick it?
– Richard Burke-Ward
1 hour ago
Exactly what I needed. Thank you. Want to promote your response to 'answer' so I can tick it?
– Richard Burke-Ward
1 hour ago
If I may: if you understand what
Limit[Integrate[test[x], x], x -> 0]
was supposed to compute, I encourage you to try writing an answer to your own question. :) I can then refine it if needed and maybe even upvote it.– J. M. is somewhat okay.♦
1 hour ago
If I may: if you understand what
Limit[Integrate[test[x], x], x -> 0]
was supposed to compute, I encourage you to try writing an answer to your own question. :) I can then refine it if needed and maybe even upvote it.– J. M. is somewhat okay.♦
1 hour ago
 |Â
show 3 more comments
1 Answer
1
active
oldest
votes
up vote
2
down vote
Thanks to the generous input of @J.M. is somewhat okay, here is the answer:
I got mixed between definite and indefinite integrals (or antiderivatives). As a result, I wrote a formula that gave the generalised integral (antiderivative) rather than the partial integral specifically between x=0
and the end-point of the plot at x=15
. I didn't spot that I'd made this assumption - and MMA, faced with an infinite range of equally valid assumptions about what constant to add to the antiderivative, chose a different number.
Subtracting a Limit
as x->0
corrects for this:
test[x_] := Sinc[Pi*x]^2 + Sinc[Pi*(x - 3)]^2 + Sinc[Pi*(x - 6)]^2 +
Sinc[Pi*(x - 9)]^2 + Sinc[Pi*(x - 12)]^2 + Sinc[Pi*(x - 15)]^2;
sumtest = Integrate[test[x], x]-Limit[Integrate[test[x], x], x -> 0];
Plot[test[x], sumtest, x, 0, 15, PlotLegends -> "Expressions"]
Very minor nit:Integrate
happened to give one possible antiderivative among infinitely many choices. Or put differently:Integrate
gave you an antiderivative, but not the one you wanted where $F(0)=0$.
– J. M. is somewhat okay.♦
55 mins ago
Noted and changed. Thanks JM :-)
– Richard Burke-Ward
40 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Thanks to the generous input of @J.M. is somewhat okay, here is the answer:
I got mixed between definite and indefinite integrals (or antiderivatives). As a result, I wrote a formula that gave the generalised integral (antiderivative) rather than the partial integral specifically between x=0
and the end-point of the plot at x=15
. I didn't spot that I'd made this assumption - and MMA, faced with an infinite range of equally valid assumptions about what constant to add to the antiderivative, chose a different number.
Subtracting a Limit
as x->0
corrects for this:
test[x_] := Sinc[Pi*x]^2 + Sinc[Pi*(x - 3)]^2 + Sinc[Pi*(x - 6)]^2 +
Sinc[Pi*(x - 9)]^2 + Sinc[Pi*(x - 12)]^2 + Sinc[Pi*(x - 15)]^2;
sumtest = Integrate[test[x], x]-Limit[Integrate[test[x], x], x -> 0];
Plot[test[x], sumtest, x, 0, 15, PlotLegends -> "Expressions"]
Very minor nit:Integrate
happened to give one possible antiderivative among infinitely many choices. Or put differently:Integrate
gave you an antiderivative, but not the one you wanted where $F(0)=0$.
– J. M. is somewhat okay.♦
55 mins ago
Noted and changed. Thanks JM :-)
– Richard Burke-Ward
40 mins ago
add a comment |Â
up vote
2
down vote
Thanks to the generous input of @J.M. is somewhat okay, here is the answer:
I got mixed between definite and indefinite integrals (or antiderivatives). As a result, I wrote a formula that gave the generalised integral (antiderivative) rather than the partial integral specifically between x=0
and the end-point of the plot at x=15
. I didn't spot that I'd made this assumption - and MMA, faced with an infinite range of equally valid assumptions about what constant to add to the antiderivative, chose a different number.
Subtracting a Limit
as x->0
corrects for this:
test[x_] := Sinc[Pi*x]^2 + Sinc[Pi*(x - 3)]^2 + Sinc[Pi*(x - 6)]^2 +
Sinc[Pi*(x - 9)]^2 + Sinc[Pi*(x - 12)]^2 + Sinc[Pi*(x - 15)]^2;
sumtest = Integrate[test[x], x]-Limit[Integrate[test[x], x], x -> 0];
Plot[test[x], sumtest, x, 0, 15, PlotLegends -> "Expressions"]
Very minor nit:Integrate
happened to give one possible antiderivative among infinitely many choices. Or put differently:Integrate
gave you an antiderivative, but not the one you wanted where $F(0)=0$.
– J. M. is somewhat okay.♦
55 mins ago
Noted and changed. Thanks JM :-)
– Richard Burke-Ward
40 mins ago
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Thanks to the generous input of @J.M. is somewhat okay, here is the answer:
I got mixed between definite and indefinite integrals (or antiderivatives). As a result, I wrote a formula that gave the generalised integral (antiderivative) rather than the partial integral specifically between x=0
and the end-point of the plot at x=15
. I didn't spot that I'd made this assumption - and MMA, faced with an infinite range of equally valid assumptions about what constant to add to the antiderivative, chose a different number.
Subtracting a Limit
as x->0
corrects for this:
test[x_] := Sinc[Pi*x]^2 + Sinc[Pi*(x - 3)]^2 + Sinc[Pi*(x - 6)]^2 +
Sinc[Pi*(x - 9)]^2 + Sinc[Pi*(x - 12)]^2 + Sinc[Pi*(x - 15)]^2;
sumtest = Integrate[test[x], x]-Limit[Integrate[test[x], x], x -> 0];
Plot[test[x], sumtest, x, 0, 15, PlotLegends -> "Expressions"]
Thanks to the generous input of @J.M. is somewhat okay, here is the answer:
I got mixed between definite and indefinite integrals (or antiderivatives). As a result, I wrote a formula that gave the generalised integral (antiderivative) rather than the partial integral specifically between x=0
and the end-point of the plot at x=15
. I didn't spot that I'd made this assumption - and MMA, faced with an infinite range of equally valid assumptions about what constant to add to the antiderivative, chose a different number.
Subtracting a Limit
as x->0
corrects for this:
test[x_] := Sinc[Pi*x]^2 + Sinc[Pi*(x - 3)]^2 + Sinc[Pi*(x - 6)]^2 +
Sinc[Pi*(x - 9)]^2 + Sinc[Pi*(x - 12)]^2 + Sinc[Pi*(x - 15)]^2;
sumtest = Integrate[test[x], x]-Limit[Integrate[test[x], x], x -> 0];
Plot[test[x], sumtest, x, 0, 15, PlotLegends -> "Expressions"]
edited 42 mins ago
answered 59 mins ago
Richard Burke-Ward
3738
3738
Very minor nit:Integrate
happened to give one possible antiderivative among infinitely many choices. Or put differently:Integrate
gave you an antiderivative, but not the one you wanted where $F(0)=0$.
– J. M. is somewhat okay.♦
55 mins ago
Noted and changed. Thanks JM :-)
– Richard Burke-Ward
40 mins ago
add a comment |Â
Very minor nit:Integrate
happened to give one possible antiderivative among infinitely many choices. Or put differently:Integrate
gave you an antiderivative, but not the one you wanted where $F(0)=0$.
– J. M. is somewhat okay.♦
55 mins ago
Noted and changed. Thanks JM :-)
– Richard Burke-Ward
40 mins ago
Very minor nit:
Integrate
happened to give one possible antiderivative among infinitely many choices. Or put differently: Integrate
gave you an antiderivative, but not the one you wanted where $F(0)=0$.– J. M. is somewhat okay.♦
55 mins ago
Very minor nit:
Integrate
happened to give one possible antiderivative among infinitely many choices. Or put differently: Integrate
gave you an antiderivative, but not the one you wanted where $F(0)=0$.– J. M. is somewhat okay.♦
55 mins ago
Noted and changed. Thanks JM :-)
– Richard Burke-Ward
40 mins ago
Noted and changed. Thanks JM :-)
– Richard Burke-Ward
40 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182463%2fplot-of-integral-of-summed-sinc-series-is-incorrect%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Integrate[test[x], x]
will give you only one of many possible antiderivatives, and not necessarily the one you want. You need an extra condition that will impose your positivity requirement.– J. M. is somewhat okay.♦
1 hour ago
OK. How do I do that?
– Richard Burke-Ward
1 hour ago
You seem to be starting from $0$, so try subtracting the result of
Limit[Integrate[test[x], x], x -> 0]
to your integral.– J. M. is somewhat okay.♦
1 hour ago
Exactly what I needed. Thank you. Want to promote your response to 'answer' so I can tick it?
– Richard Burke-Ward
1 hour ago
If I may: if you understand what
Limit[Integrate[test[x], x], x -> 0]
was supposed to compute, I encourage you to try writing an answer to your own question. :) I can then refine it if needed and maybe even upvote it.– J. M. is somewhat okay.♦
1 hour ago