Determining n in sigma ($\Sigma_{x=0}^n$) Reffered here by https://mathoverflow.net/questions/41750/determining-n-in-sigma-x0n

I'm not entirely sure if this question falls under MathOverflow but neither of my Calculus AP  teachers in high school could help me with this:

Given $\Sigma_{x=0}^n {f(x)\over2}$ and the output of the summation, how would you find $n$? I've learned how to determine the $n$ given an arithmetic or geometric sequence, but not for an arbitrary function.

Specifically, when $f(x) = 40 + 6\sqrt{x}$.

12 Oct 2010. Edit:
It seems like I need to explain the entire situation for finding $n$, the number of trapezoids, for trapezoidal rule. It started on a simple review question for Calc AP and a TI-83 program that my calc teacher gave to me to solve the definite integral with trapezoidal rules. Aiming to major in Computer Science, I took it a bit further and completely took apart the program resulting in my original question on StackOverflow: https://stackoverflow.com/questions/3886899/determining-the-input-of-a-function-given-an-output-calculus-involved

Since there were tumbleweeds for a response, I took it as a personal challenge to reverse engineer the trapezoidal program into an algebraic form with my notes found on my forum: http://www.zerozaku.com/viewtopic.php?f=19&amp;t=6041

After reverse engineering the code into some algebra, I derived the formula: 
$$TrapRule(A, B, N) = {(B-A)\over N}({F(A)\over2}+\sum_{k=1}^NF(k)+{F(B)\over2})$$

Given the values of A and B are constant for the definite integral, I should be able to isolate and solve for $N$. The problem, however, was determining $N$ in $sum_{k=1}^N$ and I came to the conclusion that it was an issue that I called recursive complexity because it was impossible to determine without recursively adding for the summation.

Eventually, I found MathOverflow and they referred me here. I was hoping only to get help on the issue for a summation because its beyond my skill as a high school student. Now that others have proposed other solutions for my dilemma, I guess I can throw out my thesis Dx

Thanks for the help though, I'll definitely be returning for more.
You are trying to calculate the inverse of the function
$$S(n)=\sum_{x=0}^n f(x)/2$$

In general the inverse would not exist (think $f(x)=0$).

If the inverse exists, a trivial way to solve your problem would be to start calculating the sum for $n=0,1,2,\ldots$ and stop when the result matches the number provided.

If you are looking for a formula for $S^{-1}(n)$, there is no reason for there to be such a formula for every $f(x)$. The arithmetic and geometric progression examples you gave were lucky exceptions.
If you don't require trapezoids of the same width, you can get a closed form by taking a partition of $[0,n]$ into intervals with endpoints  $n,nq,nq^2,\dots nq^k$ for $q&lt;1$ and $k$ large (or infinite), or by using $(i/n)^2, i=0 \dots n$ as the endpoints.  The first approach leads to the sum of a geometric series and the second is the sum of values of a polynomial.

Better answers are possible if you specify what is the problem you are ultimately trying to solve.  Is it finding the number of equal-width trapezoids needed to achieve a given accuracy in the integral $\int_0^n f(x) dx$?