Message Boards Message Boards


How to sum values of a continuous function?

Posted 8 years ago
2 Replies
0 Total Likes

Let's say I have a chi squared distribution

Plot[Evaluate@PDF[ChiSquareDistribution[4], x], {x, 0, 10}, Filling -> Axis, Exclusions -> None]

and what I want to do is sum the f(x) values if f(x) is chi squared distribution, for {x,0,10}.

Let's take an easier example so I can really explain what I want: If my function was a simple Sin[x]

Plot[Sin[x], {x, 0, 5}, Filling -> Axis]

What I want is something like


but the problem with Sum[] is that he takes x as discrete values - which I don't want. I would like it to be continuous. And I think I should repeat, this is not ArcLength it's a sum of the function values.

Thank you for any hints. If there is no other option I will just set a really small steps in the Sum. Not a really elegant solution, but it should work.

POSTED BY: Mitja Jan?i?
2 Replies

Use integration or CDF:

NIntegrate[PDF[ChiSquareDistribution[4], x], {x, 0, 10}]
CDF[ChiSquareDistribution[4], 10] // N


POSTED BY: Ivan Morozov

Yes, I thought about it too, but the problem is that I am afraid that the physical interpretation is completely wrong if I calculate the surface under the curve.

Because whatever function (or curve) I will choose, will actually be force in terms of position x. The condition says, that I have only 60 N of force available at {x,0,10} and now i want to find a couple of force distributions. And I imagined that the sum of f(x) is my condition and not the surface under it. But... That's debatable, you can still convince me wrong.

POSTED BY: Mitja Jan?i?
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract