#### Archived

This topic is now archived and is closed to further replies.

# help - integral over squared fn. is negative

This topic is 5303 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

1) i have an integral of the following form: integral(from t1 to t2) of ((at^2 + b) - (ct^2 + dt + e))^2 dt 2) now, i basically form a matrix of terms to get rid of the ^2 of the polynomial: integral(from t1 to t2) of ((a^2 * t^4) + (a * b * t^2) + ... + (e^2)) dt 3) then, to get the integral, i add 1 to the exponents, and divide by their total, etc: (a^2 * t^5 / 5) + ... + (e^2 * t^1 / 1) 4) now, i plug in t2, then subtract the case when i plug in t1: (a^2 * (t2^5 - t1^t) / 5) + ... + (e^2 * (t2^1 - t1^1) / 1) .. this should be the value of the integral, right? THE PROBLEM: i sometimes get negative values for this sum it should not be negative, because it is an integral over a squared polynomial. i was under the impression that anything squared is positive. the integral of any strictly positive function is always positive, right? how could this happen? t1 and t2 are always positive. a, b, ..., e can be positive or negative. but i don''t see how that could affect the solution. is it an overflow/underflow problem? a, b, ..., e can be very small and/or very large. please help!

##### Share on other sites
The integral can be negative because the curve can be negative.

btw, when you''re subtracting two polynomials and then squaring the result, it''s easier to get something like
(a-c)t^2 - d*t + (b-e). The square of this, then, is just the sum of each term squared plus the sum of twice the each combination of the terms, or in this case:
(a-c)^2*t^4 + d^2 t^2 + (b-e)^2 - 2 (a-c)d*t^3 + 2(a-c)(b-e)t^2 - 2d(b-e)t

Collecting terms again:
(a-c)^2*t^4 - 2(a-c)d*t^3 + 2d^2(a-c)(b-e)t^2 - 2d(b-e)t + (b-e)^2

First of all, there''s the degenerate case where a = c, in which case it becomes
-2d(b-e)t + (b-e)^2, which is just a line.

With other cases, the curve can be negative when t is negative.

##### Share on other sites
quote:
Original post by Flarelocke
Collecting terms again:
(a-c)^2*t^4 - 2(a-c)d*t^3 + 2d^2(a-c)(b-e)t^2 - 2d(b-e)t + (b-e)^2

No, it should be:

(a-c)^2*t^4 - 2(a-c)d*t^3 + (d^2 + 2(a-c)(b-e))t^2 - 2d(b-e)t + (b-e)^2

quote:
First of all, there''s the degenerate case where a = c, in which case it becomes
-2d(b-e)t + (b-e)^2, which is just a line.

No, it should be

d^2*t^2 - 2d(b-e)t + (b-e)^2 = (d*t - b + e)^2

quote:
With other cases, the curve can be negative when t is negative.

No, there is no way the curve can be negative (assuming real variables).

1. 1
2. 2
Rutin
15
3. 3
4. 4
5. 5

• 9
• 9
• 14
• 12
• 10
• ### Forum Statistics

• Total Topics
633270
• Total Posts
3011158
• ### Who's Online (See full list)

There are no registered users currently online

×