# Thread: Who wants to do some maths for me?

1. ## Who wants to do some maths for me?

I need to work out a fee calculator, but i cant for the life of me figure out the equation to do it. Anyone want to show off their skills?
The calculator works like this. The figures are approx ( a couple of dollars either way does not matter)
Min charge $4.95. The Fee starts at$4.95 and goes up to $29.95 an so on. The fees go up depending on the amount deposited with a fee ending at the amount of F. The deposit are up to the amount in D. So each dollar amount entered goes up in scale - which varies. D refers to Deposit and F refers to the fee charged. D$700 F $29.95 D$1000 F $32.95 D$2000 F $33.95 D$5000 F $55.00 D 10,000 F$70
D 25,000 F $160 D 50,000 F$280
D 75,000 F $350 D 100,000 F$380 which is the maximum fee.

So basically, I want field that you enter and amount into "D", the calculator has the formula already and spits out the answer of "F".

Who's game?

2. There is no clear relation ship between F & D in this case.

I would create an excel sheet with a look up table to determine F for any D entered into a cell.

3. Hi,

I had thought of that. I'm sure their must be an equation though.

thanks

4. None that I know.

5. I did get this advice, but it is unfinshed and I have no way of testing it:

Polynomials would never be a good fit: for example it must go to either -infinity or +infinity, thus violating the assumptions for min or max.

For this question, line segments make more sense. You are given 10 data points (including (0, 4.95)): let's label them as (x_0, y_0), ..., (x_9, y_9), where (x_0, y_0) = (0, 4.95), etc.

The slopes between (x_(i-1), y_(i-1)) and (x_i, y_i) is

m_i = (y_i-y_(i-1))/(x_i-x_(i-1)), for i = 1, ..., 9.

Now you can always find the function of the form:

f(x) = sum_{i=0 to 9} a_i*|x-x_i| + b, subject to the slope condition

a_0 - a_1 - a_2 ... - a_9 = m_1
a_0 + a_1 - a_2 ... - a_9 = m_2
...
a_0 + a_1 +... +a_8 -a_9 = m_9
a_0 + a_1 +... +a_8 +a_9 = 0 (this last equation takes care of the slopes for x < 0, and x > x_9)

and b is chosen so that f(0) = 4.95.

This is a system of equation with 10x10 matrix of full rank, hence solvable. (in fact the coefficient determinant is 2^9 > 0)

Therefore the formula does exist.

6. Originally Posted by paullovesjo
I need to work out a fee calculator, but i cant for the life of me figure out the equation to do it. Anyone want to show off their skills?
The calculator works like this. The figures are approx ( a couple of dollars either way does not matter)
Min charge $4.95. The Fee starts at$4.95 and goes up to $29.95 an so on. The fees go up depending on the amount deposited with a fee ending at the amount of F. The deposit are up to the amount in D. So each dollar amount entered goes up in scale - which varies. D refers to Deposit and F refers to the fee charged. D$700 F $29.95 D$1000 F $32.95 D$2000 F $33.95 D$5000 F $55.00 D 10,000 F$70
D 25,000 F $160 D 50,000 F$280
D 75,000 F $350 D 100,000 F$380 which is the maximum fee.

So basically, I want field that you enter and amount into "D", the calculator has the formula already and spits out the answer of "F".

Who's game?
Try:

$F=20+500(1-e^{-0.000137P})$

CB

7. Looks interesting.

Now - how do I go about using that magical formula.

Do you know of an online calculator I could use?

Let say I wanted to enter $1500.00 and calculate what the fee would be. How do I use that formula? You may have guessed, maths wasnt one of my strongest subjects. Could you enlighten me? Thanks 8. Originally Posted by paullovesjo Looks interesting. Now - how do I go about using that magical formula. Do you know of an online calculator I could use? Let say I wanted to enter$1500.00 and calculate what the fee would be. How do I use that formula?

You may have guessed, maths wasnt one of my strongest subjects.

Could you enlighten me?

Thanks
Google will do it, enter as:

20+500*(1-exp(-0.000137*1500))

CB

9. I got this from a maths guru. Unfortunately, he cant fathom how I dont understand it.

Does anyone know how I would enter this into a google calculator and where i would enter say $32,000 into the equation so that I get an answer to the equation? Alright, if you solve the system of equations I mentioned earlier (either by hand or by using a calculator, say TI83 or TI84), you get the following numbers (there may be rounding error for the numbers listed below): a_0 = 0.017857 a_1 = -0.01286 a_2 = -0.0045 a_3 = 0.003008 a_4 = -0.00201 a_5 = 0.0015 a_6 = -0.0006 a_7 = -0.001 a_8 = -0.0008 a_9 = -0.0006 Therefore the formula for the function is (denoting square root by sqrt) f(x) = 0.017857*sqrt((x-0)^2) -0.01286*sqrt((x-700)^2) -0.0045*sqrt((x-1000)^2) +0.003008*sqrt((x-2000)^2) -0.00201*sqrt((x-5000)^2) +0.0015*sqrt((x-10000)^2) -0.0006*sqrt((x-25000)^2) -0.001*sqrt((x-50000)^2) -0.0008*sqrt((x-75000)^2) -0.0006*sqrt((x-100000)^2) + b. To determine b, substitute 0 for x, since f(0) = 4.95, you get b = 192.475. In conclusion the sought for formula is f(x) = 0.017857*sqrt((x-0)^2) -0.01286*sqrt((x-700)^2) -0.0045*sqrt((x-1000)^2) +0.003008*sqrt((x-2000)^2) -0.00201*sqrt((x-5000)^2) +0.0015*sqrt((x-10000)^2) -0.0006*sqrt((x-25000)^2) -0.001*sqrt((x-50000)^2) -0.0008*sqrt((x-75000)^2) -0.0006*sqrt((x-100000)^2) + 192.475. I have checked the formula in Excel, it works well, since the rounding error is negligible. To avoid rounding error, you could obtain those a_i by the following formulas, which I have solved for you a_0 = m_1/2, a_1 = (m_2-m_1)/2 a_2 = (m_3-m_2)/2 a_3 = (m_4-m_3)/2 a_4 = (m_5-m_4)/2 a_5 = (m_6-m_5)/2 a_6 = (m_7-m_6)/2 a_7 = (m_8-m_7)/2 a_8 = (m_9-m_8)/2 a_9 = -m_9/2, where m_i is the slope of the line joining (x_(i-1), y_(i-1)) to (x_i, y_i) for i = 1, 2, ..., 9. (For example, (x_0, y_0) = (0, 4.95), (x_1, y_1) = (700, 29.95), hence m_1 = (29.95 - 4.95)/(700 - 0), etc.) 10. Originally Posted by paullovesjo I got this from a maths guru. Unfortunately, he cant fathom how I dont understand it. Does anyone know how I would enter this into a google calculator and where i would enter say$32,000 into the equation so that I get an answer to the equation?

Alright, if you solve the system of equations I mentioned earlier (either by hand or by using a calculator, say TI83 or TI84), you get the following numbers (there may be rounding error for the numbers listed below):
a_0 = 0.017857
a_1 = -0.01286
a_2 = -0.0045
a_3 = 0.003008
a_4 = -0.00201
a_5 = 0.0015
a_6 = -0.0006
a_7 = -0.001
a_8 = -0.0008
a_9 = -0.0006
Therefore the formula for the function is (denoting square root by sqrt)
f(x) = 0.017857*sqrt((x-0)^2) -0.01286*sqrt((x-700)^2) -0.0045*sqrt((x-1000)^2) +0.003008*sqrt((x-2000)^2) -0.00201*sqrt((x-5000)^2) +0.0015*sqrt((x-10000)^2) -0.0006*sqrt((x-25000)^2) -0.001*sqrt((x-50000)^2) -0.0008*sqrt((x-75000)^2) -0.0006*sqrt((x-100000)^2) + b.
To determine b, substitute 0 for x, since f(0) = 4.95, you get b = 192.475.
In conclusion the sought for formula is
f(x) = 0.017857*sqrt((x-0)^2) -0.01286*sqrt((x-700)^2) -0.0045*sqrt((x-1000)^2) +0.003008*sqrt((x-2000)^2) -0.00201*sqrt((x-5000)^2) +0.0015*sqrt((x-10000)^2) -0.0006*sqrt((x-25000)^2) -0.001*sqrt((x-50000)^2) -0.0008*sqrt((x-75000)^2) -0.0006*sqrt((x-100000)^2) + 192.475.
I have checked the formula in Excel, it works well, since the rounding error is negligible.
To avoid rounding error, you could obtain those a_i by the following formulas, which I have solved for you
a_0 = m_1/2,
a_1 = (m_2-m_1)/2
a_2 = (m_3-m_2)/2
a_3 = (m_4-m_3)/2
a_4 = (m_5-m_4)/2
a_5 = (m_6-m_5)/2
a_6 = (m_7-m_6)/2
a_7 = (m_8-m_7)/2
a_8 = (m_9-m_8)/2
a_9 = -m_9/2,
where m_i is the slope of the line joining (x_(i-1), y_(i-1)) to (x_i, y_i) for i = 1, 2, ..., 9. (For example, (x_0, y_0) = (0, 4.95), (x_1, y_1) = (700, 29.95), hence m_1 = (29.95 - 4.95)/(700 - 0), etc.)
Now why do I think that is linear interpolation between the tabulated values?

CB