Antiderivative (indefinite integral)?

Hello all, not strictly a Haskell question, but anyways ... is it possible to compute the antiderivative of a function f::Int->Int ? I understand that you can compute the definite integral by simply summing up the values of f within a given interval. My first guess would be: no this is not possible. The antiderivative F of a function f::Int->Int needs to have the property that F(b) - F(a) must be the sum of f within [a,b]. To do this I must know all values withib [a,b]. But at the time I compute the antiderivative I do not know this interval yet. What is striking me is that in calculus I can often symbolically compute the antiderivative and I get a simple function, and I can get the value of F for a given x and I get a simple number. Why is that so? -- Martin

A 19/01/2013, às 18:55, Martin Drautzburg escreveu:
Hello all,
not strictly a Haskell question, but anyways ...
is it possible to compute the antiderivative of a function f::Int->Int ?
I understand that you can compute the definite integral by simply summing up the values of f within a given interval.
My first guess would be: no this is not possible. The antiderivative F of a function f::Int->Int needs to have the property that F(b) - F(a) must be the sum of f within [a,b]. To do this I must know all values withib [a,b]. But at the time I compute the antiderivative I do not know this interval yet.
What is striking me is that in calculus I can often symbolically compute the antiderivative and I get a simple function, and I can get the value of F for a given x and I get a simple number. Why is that so?
That’s due to the http://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus together with rules for certain functions that allow you to symbolically get your antiderivative. Off course, those tricks don’t work for all functions, there are functions which are know to have an antiderivative but which cannot be given an analytical expression. If you implement the rules I mentioned in haskel then you can get the the antiderivative by substitution for a subset of functions which also have to be encoded symbolically. best, Miguel

I'd like to add that Haskell cafe is probably a better place to ask questions like these. Beginners mailing list is a bit more about basics of working with Haskell itself while cafe is a lot more meta. On 19/01/13 20:25, Miguel Negrao wrote:
A 19/01/2013, às 18:55, Martin Drautzburg escreveu:
Hello all,
not strictly a Haskell question, but anyways ...
is it possible to compute the antiderivative of a function f::Int->Int ?
I understand that you can compute the definite integral by simply summing up the values of f within a given interval.
My first guess would be: no this is not possible. The antiderivative F of a function f::Int->Int needs to have the property that F(b) - F(a) must be the sum of f within [a,b]. To do this I must know all values withib [a,b]. But at the time I compute the antiderivative I do not know this interval yet.
What is striking me is that in calculus I can often symbolically compute the antiderivative and I get a simple function, and I can get the value of F for a given x and I get a simple number. Why is that so?
That’s due to the http://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus together with rules for certain functions that allow you to symbolically get your antiderivative. Off course, those tricks don’t work for all functions, there are functions which are know to have an antiderivative but which cannot be given an analytical expression. If you implement the rules I mentioned in haskel then you can get the the antiderivative by substitution for a subset of functions which also have to be encoded symbolically.
best, Miguel _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

It is still somewhat strange. For a discrete function f(i) I can compute
What is striking me is that in calculus I can often symbolically compute
Just surveying this thread, it appears a bunch of issues are being mixed-up: (1) the distinction between continuous and discrete functions, and the extent to which the latter serves as an approximation of the former Derivative IS-TO antiderivative IS-TO integral AS (finite) difference IS-TO "anti-difference" IS-TO (discrete) summation. (2) the FP notion of closure I'll respond to a small slice of (1) and most of (2). (1) the definite integral F(b) - F(a) but I cannot compute F(a) or F(b) themselves. Right? In the continuous case, the antiderivative is defined /up to an additive constant/. In calculating the definite integral, the constant gets cancelled out because it is the same on both sides of the subtraction. the antiderivative and I get a simple function, and I can get the value of F for a given x and I get a simple number. Why is that so? So no, you don't get a simple number. It is ambiguous to evaluate the antiderivative at a point. Unless you set down an arbitrary rule such as: the antiderivative must pass through the origin, i.e. F(0)=0. In the discrete case, you must first fully define which of forward / backward / central difference you're adopting. AND adopt some arbitrary rule to deal with the additive constant. Finally, you can define the anti-difference F(x) of f(x) appropriately to obtain the equation you desire: F(b)-F(a)=sum of f from a to b inclusive.
however for the antiderivative I have to look at all values between the lowest possible x and the running x. If the function is discrete but has no lower bound for x, then I cannot compute an antiderivative at all, at least not one which will be correct for any x.
The antiderivative F of a function f::Int->Int needs to have the property
Using the F(0)=0 rule, you'll be summing /about the origin/. So you'd avoid nastiness like having to sum f(x) starting from "the lowest possible x". (2) that F(b) - F(a) must be the sum of f within [a,b]. To do this I must know all values withib [a,b]. But at the time I compute the antiderivative I do not know this interval yet. It's easy to write an integrator :: (Int -> Int) -> Int -> Int -> Int, where integrator takes a function f, and bounds of the interval a and b. By partially applying to a particular function f1, we get a function Int -> Int -> Int which integrates f1 given whatever bounds. The latter can be further partially applied with the lower bound fixed at 0 to obtain a function Int -> Int, which sums f1 from 0 to the given number. On the other hand, we can fix the bounds [a,b] to obtain a specialized integrator: (Int -> Int) -> Int, that varies over the /function/ rather than over the /interval/. Partial application (Schemers, read "closure") makes this all possible. p.s. Everyone, please "Reply to All" to make sure your email gets to the list reflector at haskell.org. Otherwise your responses are private to Martin and you lose out on the aspect of community. -- Kim-Ee

A 20/01/2013, às 05:50, Kim-Ee Yeoh escreveu:
p.s. Everyone, please "Reply to All" to make sure your email gets to the list reflector at haskell.org. Otherwise your responses are private to Martin and you lose out on the aspect of community.
I don’t understand: why can’t this mailing automatically set the “reply-to” field to beginners@haskell.org ? A lot of the other mailing lists that I’m subscribed to do that... Is it a conscious decision or a technical limitation ? best, Miguel

On Mon, Jan 21, 2013 at 3:07 AM, Miguel Negrao < miguel.negrao-lists@friendlyvirus.org> wrote:
p.s. Everyone, please "Reply to All" to make sure your email gets to the
A 20/01/2013, às 05:50, Kim-Ee Yeoh escreveu: list reflector at haskell.org. Otherwise your responses are private to Martin and you lose out on the aspect of community.
I don’t understand: why can’t this mailing automatically set the “reply-to” field to beginners@haskell.org ? A lot of the other mailing lists that I’m subscribed to do that... Is it a conscious decision or a technical limitation ?
Excellent question! I believe we're on mailman software and the list admin is Benjamin Russell: DekuDekuplex@Yahoo.com or beginners-owner@haskell.org I've cc'ed both to see if we can get a response from him. It does look as if it's merely a config option: http://ccit.mines.edu/Mailman-FAQ#25 -- Kim-Ee

On Sunday, 20. January 2013 06:50:27 Kim-Ee Yeoh wrote:
So no, you don't get a simple number. It is ambiguous to evaluate the antiderivative at a point.
So F(x=x0) has no meaning in itself? Only the differences F(x=x1) - F(x=x0) have a meaning?
Using the F(0)=0 rule, you'll be summing /about the origin/. So you'd avoid nastiness like having to sum f(x) starting from "the lowest possible x".
Thanks. It took me a while to fully understand what you said here. -- Martin

If you don't care about efficiency, you can define antideriv :: (Int -> Int) -> Int -> Int antideriv f x | x >= 0 = sum [ f y | y <- [0..x-1] ] | x < 0 = - sum [ f y | y <- [x..-1] ] which has the property that antideriv f x1 - antideriv f x0 == sum [f x | x <- [x0..x1-1]] Twan On 19/01/13 19:55, Martin Drautzburg wrote:
Hello all,
not strictly a Haskell question, but anyways ...
is it possible to compute the antiderivative of a function f::Int->Int ?
I understand that you can compute the definite integral by simply summing up the values of f within a given interval.
My first guess would be: no this is not possible. The antiderivative F of a function f::Int->Int needs to have the property that F(b) - F(a) must be the sum of f within [a,b]. To do this I must know all values withib [a,b]. But at the time I compute the antiderivative I do not know this interval yet.
What is striking me is that in calculus I can often symbolically compute the antiderivative and I get a simple function, and I can get the value of F for a given x and I get a simple number. Why is that so?
participants (5)
-
Kim-Ee Yeoh
-
Martin Drautzburg
-
Mateusz Kowalczyk
-
Miguel Negrao
-
Twan van Laarhoven