# Thread: tuning a parabola for a specific outcome

1. ## tuning a parabola for a specific outcome

Hello,

I have some data,
(x,y)
(2, 0.356)
(3, 0.543)
(4, 0.724)
(5, 0.905)
(6, 1.086)
(7, 1.267)
(8, 1.448)
(9, 1.629)
(10, 1.810)
(11, 1.991)
(12, 2.188)
(13, 2.364)

the x,y plot is linear and the correlation R is 1.

The y value is a coefficient and I would like to non-linearize the coefficioent to create the following conditions;
when x=2, y=1
when x=13, y=2
when x=7, y=4

If I apply a parabolic transformation

y= A*(x^2) + (B*x) + C

with,
A = -2.42
B = 7.1
C = -1.222

I get close, but the maximum values is at x = 8, y= 3.985

This is the transformed x,y data
(x,y)
((2, 1.0)
(3, 1.920)
(4, 2.650)
(5, 3.222)
(6, 3.635)
(7, 3.889)
(8, 3.985)
(9, 3.922)
(10, 3.700)
(11, 3.320)
(12, 2.729)
(13, 2.040)

I need to shift the relative maximum of the parabola to be at x=7.

What I have so far was done by trial and error, but there must be a theorem that would allow me to solve for the correct polynomial and back engineer a solution.

I have attached an excel spreadsheet with the data and plots in case that helps.

Please feel free to move this post if I have put it in the wrong forum and thanks in advance for any help you can give.

LMHmedchem

2. ## Re: tuning a parabola for a specific outcome

your in general form $\displaystyle ax^2+bx+c$ which looks like a tough slog. you could probably get there quicker with standard form $\displaystyle a(x-h)^2+k$. where (h,k) is the vertex. to go from standard to general form complete the square.

3. ## Re: tuning a parabola for a specific outcome

Completing the square is something I remember hearing about once, but that was very long ago. I don't even know where to begin with that at the moment.

Using a(x-h)^2 + y

only gets me half the parabola with the x=2 value as the minimum or maximum depending on the sign of a. I need the value of y to start low, reach a maximum, and then come back down over the x range 2,13.

Should I be using a different polynomial?

LMHmedchem

4. ## Re: tuning a parabola for a specific outcome

$\displaystyle f(x)=a(x-h)^2+k$

a=the number that stretches the parabola. values under 1 flatten it out.
h=the shift of the vertex(ie. lowest or highest point) of the parabola left or right.
k=the shift up or down of the parabola.

so if you want the highest y values at (7,1.267) the h=-7 k=1.267.
now to flatten out the curve to match your data set a=-0.04 or something like that. if your interested in x DOMAIN 2...13. remember the range is y values.

so you get $\displaystyle f(x)=-0.04(x-7)^2+1.267$

once you expand and collect you get $\displaystyle f(x)=-0.04x^2+0.56x-0.693$

does this even remotely help you? fiddle with h,k,a in standard form then expand into general form if you need to. altho your not going to turn a line into a parabola and have your values match up all that well.

if you want something that is linear that goes to a target value then back down linear use a absolute value function Absolute value - Wikipedia, the free encyclopedia

5. ## Re: tuning a parabola for a specific outcome

Originally Posted by skoker

$\displaystyle f(x)=a(x-h)^2+k$

a=the number that stretches the parabola. values under 1 flatten it out.
h=the shift of the vertex(ie. lowest or highest point) of the parabola left or right.
k=the shift up or down of the parabola.

so if you want the highest y values at (7,1.267) the h=-7 k=1.267.
now to flatten out the curve to match your data set a=-0.04 or something like that. if your interested in x DOMAIN 2...13. remember the range is y values.

so you get $\displaystyle f(x)=-0.04(x-7)^2+1.267$

once you expand and collect you get $\displaystyle f(x)=-0.04x^2+0.56x-0.693$

does this even remotely help you? fiddle with h,k,a in standard form then expand into general form if you need to. altho your not going to turn a line into a parabola and have your values match up all that well.

if you want something that is linear that goes to a target value then back down linear use a absolute value function Absolute value - Wikipedia, the free encyclopedia
I have played around with what you sent a bit, and the plots don't make any sense to me, so I may be plotting it wrong. I have attached a new version of the spreadsheet. If you use the ahk version of the equation with a=0.04, h=-7, k=1.26 while entering each x to generate the corresponding y, the y values start at 1.5 and get smaller. The function is non-linear, but it doesn't go up and back down, just down. If you use the abc version, with a=0.04, b=0.56, c=-0.693, the resulting y point are almost linear with respect to x.

I think this needs to be non-linear, but I won't know for sure until I have more data to tune the function to. The rank order is more important than the absolute values of the output y. I need the maximum to be at x=7 and the value for x=13 to be roughly half the value of y at x=7, but it by no means needs to be exact.

If you look at the spreadsheet, my original value is in col E, col F is using the ahk version and col G is abc based on the coefficients you provided. It seems like col F and G should be the same, but they aren't close, so I am wondering if I have set this up wrong.

I can't get the hka form to make a turn on the plot. No matter what I do I only get one side of the parabola. My understanding is there is some polynomial that will transform most any data into most anything else. Would I be better off with a different form?

It seems as if I am explaining this wrong.

The x I am inputting is the ratio value and the y I am getting is what I am calling the coefficient. It is the ratio value I am trying to transform so that the transformed version = ~4 where the current ratio = 1.267. Since the ratio is correlated to the distance, you could plot with either the distance or ratio as x. I changed the plots so the they show the ratio as x and the coefficient as y.

It seems as if h should equal 1.26 and k should = 4, but that plot doesn't look any different.

LMHmedchem

6. ## Re: tuning a parabola for a specific outcome

I don't have the software to look at the spreadsheet. I was just going off of the point plots you posted in the thread. I think from the terminology your using there may be a certain way that the application your using is dealing with the mathematics. perhaps a nonstandard coordinates, maybe a special ways of formatting expressions. I'm not to sure.

what I do know is that if you have a calculator handy and you type in that function and replace x with 2...12 you get back one corresponding y value. and with those you have your (x,y) point plot. they form a gentile arc starting at (2,0.267) ... (7,1.267) then back down. beyond that I'm not sure how to proceed.

7. ## Re: tuning a parabola for a specific outcome

Originally Posted by skoker
I don't have the software to look at the spreadsheet. I was just going off of the point plots you posted in the thread. I think from the terminology your using there may be a certain way that the application your using is dealing with the mathematics. perhaps a nonstandard coordinates, maybe a special ways of formatting expressions. I'm not to sure.

what I do know is that if you have a calculator handy and you type in that function and replace x with 2...12 you get back one corresponding y value. and with those you have your (x,y) point plot. they form a gentile arc starting at (2,0.267) ... (7,1.267) then back down. beyond that I'm not sure how to proceed.
Thanks for all your help so far.

When I plot
$f(x)=-0.04x^2+0.56x-0.693$

minimum x = 0.356 (corresponds to distance 2)
y = -0.04*(0.356)^2 + 0.56*(0.356) + -0.693
y = -0.005074 + 0.199453 - 0.693
y = -0.499

x = 1.267 (corresponds to distance 7, should be maximum)
y = -0.04*(1.267)^2 + 0.56*(1.267) + -0.693
y = -0.064241 + 0.709682 - 0.693
y = -0.048

maximum x = 2.364 (corresponds to distance 13)
y = -0.04*(2.364 )^2 + 0.56*(2.364 ) + -0.693
y = -0.223540 + 1.32384 - 0.693
y = 0.407

This is not what you are getting, so I must be doing something wrong.

I am going to repost the question below, since I think I have managed to confuse things. Also, I have decided to change the volume metric to something that gives the same results for each row and to drop the last pattern, since it has a different volume than the others.

You should be able to open the excel spreadsheet with the open office calc program. I have attached a new version with the revised data.

Here is the revised post:

I have three columns of numbers, where the ratio is given as distance/volume.

(volume, distance, ratio)
(8.648, 2, 0.231)
(8.648, 3, 0.347)
(8.648, 4, 0.463)
(8.648, 5, 0.578)
(8.648, 6, 0.694)
(8.648, 7, 0.809)
(8.648, 8, 0.925)
(8.648, 9, 1.041)
(8.648, 10, 1.156)
(8.648, 11, 1.272)
(8.648, 12, 1.388)

The ratio has a useful meaning to some additional properties, but the relation to those properties is not linear. I am trying to transform the ratio value into something more parabolic such that the following conditions are met (roughly).

Where x is the ratio value and y is the transformed value of ratio,
x = 0.231, y = 1
x = 0.809, y = 3
x = 1.388, y = 2

The value of y needs to rise as x increases, reach a maximum at x = 0.890, and descend down to 2 by x = 1.388.

If I use the standard form of a parable y= Ax^2 + Bx + C with
A = -3.8, B = 7.8, C = -0.6
I get somewhere in the neighborhood.

(ratio, y)
(0.231, 1.001)
(0.347, 1.648)
(0.463, 2.195)
(0.578, 2.639)
(0.694, 2.982)
(0.809, 3.224)
(0.925, 3.364)
(1.041, 3.402)
(1.156, 3.338)
(1.272, 3.173)
(1.388, 2.907)

This solution was arrived at by trial and error in excel. This is the excel equation.

(($B$17)*(I2*I2)) + ($C$17*I2) + $D$17

where A = $B$17, B = $C$17, C = $D$17

There are some issues here. The maximum value comes at x = 1.041, which is the main issue. The value for x = 1.388 is also not low enough. It seems like I should be able to create an equation with my desired parameters and solve for the proper set of coefficients, but I am not a very nimble mathematical, so I could really use some help with this.

It would also be very useful to be able to adjust the height of the vertex and other such features. I don't know if a parabola is the best function to use, but seems close.

It seems like I should be able to create an equation with my desired parameters and solve for the proper set of coefficients, but I am not a very nimble mathematical, so I could really use some help with this. I was thinking about three simultaneous equations

1 = A*(0.231^2) + B*(0.231) + C
3 = A*(0.809^2) + B*(0.809) + C
2 = A*(1.388^2) + B*(1.388) + C

Solving for A, B, and C, though it wouldn't be necessary to solve for the constant, since that can be adjusted after the fact.

It would also be very useful to be able to adjust the height of the vertex and other such features. I don't know if a parabola is the best function to use, but seems close.

Thanks again for the assistance,

LMHmedchem