As you may or may not know, the theory of math integration started with what
is called the Peano-Jordan measure.
In order to calculate the integral of a function, they started calculating the area subtended by the
function.
The process is simple (and you can see the picture to understan it): let's say you want to calculate the
area subtended by the function p(x) in a given interval [x1,x2]. All you have to do
is divide this interval in a finite number of steps and build rectangles as shown in the picture. Since
the function I'll give you is continuous because it is a polynomial function ( p(x) ) you are sure that
the vertical lines of the rectangles are going to meet the function somewhere. In each interval you get
multiple values of the function because each step is made by infinite points. For each step you can take
either the max(p(x)), or min(p(x)) or an average value that can be either avg(x)=[max(p(x)+min(p(x))]/2
or the value that the function gets in the middle point of each step.
Depending on what value you take you get an area approximation which is a little bigger than the real
area (taking max(p(x))), a little smaller than the real area (taking min(p(x))) or very near the real
area (taking avg(p(x))).
Anyway, Riemann has proved that when the measure of each step becomes
smaller and smaller (tending to 0) all these values tend to one value which is the correct area.
What you're asked to do here is to calculate an approximation of the area using a step length of 0.01
units
and taking the middle value to calculate the height of the rectangles. The middle value is the
value that p(x) gets in the exact middle point of each step.
So, if for a given p(x) in a certain step
you get min(p(x))=8, max(p(x))=10 and middle(p(x))=8.5, even if the average avg(p(x))=9 I want you to use
8.5.
The area of that rectangle will then be 8.5*0.01=0,085 units². The total area is the sum of
each rectangle area you'll get from x1 to x2. If for example x1=1 and
x2=4 you're going to calculate (4-1)/0.01=3*100=300 rectangles.
Note that if middle(p(x))<0 then p(x) in that point is negative and the corresponding rectangle
will be negative too.
The polynomial I provide has this structure:
p(x) = (n0/d0) + (n1/d1)*x^1 + ... + (nk/dk)*x^k (where "+" signs could be "-" either and where the first coefficient could be negative as well)
k is random calculated by my script and nk, dk are the
random numerator and denominator of the kth coefficient of p(x).
So, resuming:
When you have the correct approximation pick up the absolute value and round it to an integer then calculate the lowercase md5 of the number.
That will be the solution you have to pass to the solution page.
Example 1: 345.23 -> solution=md5(345)
Example 2: 123.89 -> solution=md5(124)
Example 3: -567.44 -> solution=md5(567)
Example 4: -567.50 -> solution=md5(568)
Notes: to calculate the result the script uses regular php vars.
To check php's floating point precision go to www.php.net
Click here to start the challenge
"http://bright-shadows.net/GDO/TBS/challenges//programming/peanojordan/solution.php?solution="+letters