The smallest code that gives the area between the curve p(x) = a0 + a1*x + a2*x2 + ..., the line y = 0, the line x = 0 and the line x = C
(i.e. something like this:
You can assume that p(x) >= 0 for x < C (bonus points if your code works for negative values of p(x)).
C, a0, a1, ...
a real number - the area
input: 2, 0, 1 output: 2.0
input: 3.0, 0, 0.0, 2 output: 18
- C > 0 is also assumed
- the area is between the curve, y=0, x=C and x = 0
- the input can be a list of any form; not necessarily comma separated.
- the output can be a real of any form (thus, '18' is a valid output, as is '18.0')