by simpComp
 P: 44 Hello, Help! I am stuck again Okay, I vaguely remember how to factorize the following: 0 = 2x^2 + 5x - 7 The above is easy since all we have to do is find two numbers that when multiplied together gives us -14, and we have to find two numbers that when added together gives us 5, hence, 7 and -2!!! So it becomes: (2x+7) (x-1) Now I need to do the same factorization but for this: 114 = -0.026x^2 + 1.928x + 90.96 -0.026x^2 + 1.928x -23.04 = 0 Here, I have to find two numbers that when multiplied together gives us (0.026*-23.04) 0.59904 and we have to do is find two numbers that when added together gives us 1.928... how do I find that Is there a mathematical tool in Excel that can do this for me? Once I can factor my equation I can come up with an equation where I can solve for x every time! So no matter what y is, I can plug y into an equation and figure out x. thanks for your help!
 Mentor P: 9,614 There is a general equation for the solutions of a quadratic equation. If x1 and x2 are solutions, your equation is equivalent to (x-x1)(x-x2)=0.
 P: 414 You could always try completing the square. So for your "simple" example your equation is 2x2 + 5x - 7 = 0 ∴ x2 + 5x/2 - 7/2 = 0 ∴ (x+5/4)2 -7/2 -25/16 = 0 ∴ (x+5/4)2 -81/16 = 0 ∴ (x+5/4) = ± 9/4; so x =? Can you do similar for your advanced one? Alternatively, try something like http://mathportal.org/calculators/so...ion-solver.php ?
P: 44

thanks sjb-2812,

Okay I tried it with the calculator and it does work... please view attachment... GAWD!! this reminds me of high school and college!!!!!! To bad I don't have much time to review this stuff.

Any how, I would have to now find a way to enter this in my micro-controller so that, given any 'y' value I would be able to solve for 'x2'.

Attached Thumbnails

P: 599
 Quote by simpComp thanks sjb-2812, Any how, I would have to now find a way to enter this in my micro-controller so that, given any 'y' value I would be able to solve for 'x2'.
You should be aware that the quadratic formula as usually presented can be numerically ill conditioned in some cases. The formula can be manipulated into a version that is less subject to such problems.

A quick trip to Google found a reference near the bottom of http://introcs.cs.princeton.edu/java/91float/

Look for item 17 there.
 P: 44 Well as shown in example calculator.. is it okay if I always put it in terms of a fraction and then multiply every term by the lowest common denominator as done in this case by 500???
HW Helper
P: 2,692
 Quote by simpComp Well as shown in example calculator.. is it okay if I always put it in terms of a fraction and then multiply every term by the lowest common denominator as done in this case by 500???
The idea is to make the equation simpler, or easier to manage its solution. There are rational coefficients and since 500 is the lowest common denominator, multiplying both sides of the equation by 500 will clear the fractions.
P: 44
Hello fellows... I am having a hard time..... jeeeze doing math once every 5 years is not fun!

Therefore I have tried sticking with the quadratic... since I won't be going with very much small numbers anyways... and also for simplicity. The completing the square way... is long in terms of programming... for now I will try the quadratic.

 The idea is to make the equation simpler, or easier to manage its solution. There are rational coefficients and since 500 is the lowest common denominator, multiplying both sides of the equation by 500 will clear the fractions.
okay

So, I have tried two points on my graph and one works out but the other doesn't.

Given by Excel calculator here is the equation of the graph in Q1 attachment:

y = -0.026x^2 +1.928x + 90.96

In Q2 I used the quadratic formula to solve for x when y = 114. The result was very close to 14 which is quite acceptable. However, in Q2, when I tried to solve for x when y = 126, x was way off.. does someone see something I am doing wrong. I was supposed to get 38.. instead I calculated 31 ??? Also, I did another point at: (30, 124)... when I tried to solve for x when y is 124, I get 26.8" instead of 30". Why is it so imprecise ???

Also, I was wondering if the equation:

y = -0.026x^2 +1.928x + 90.96

can be used to figure out a y value of 140?? Because, that's what I need, I may require to go further on the x axis then what the graph shows...
Therefore I don't know if a quadratic is right here... confused!!!

In summary, the x axis can go til about 240 inches when the y axis is about 155 steps. I need a formula that no matter what the y value is, I can figure out the respective x value!
Here, in the office I can test up to about 54" max... but based on these values, isn't there a way that we can get a formula that will allow calculations up to when y = 155 steps???

PS. Please note that for these calculations, I didn't bother finding a common denominator as the calculator does at: http://mathportal.org/calculators/so...ion-solver.php ?

Thanks for all help!
Attached Thumbnails

HW Helper
P: 2,692
 can be used to figure out a y value of 140?? Because, that's what I need, I may require to go further on the x axis then what the graph shows... Therefore I don't know if a quadratic is right here... confused!!!
Visually, in image q1, a parabolic fit seems like a good choice. Notice, you have FIVE points to choose from. You only need a combination of ANY THREE points to find a model. Try a few different combinations of points and then check how each resulting model give computations that are near or not near.
 P: 44 Okay symbolipoint, First and foremost, I want to thank you for your help and patience with me. I have made some recent changes based on your suggestions. I re-calibrated my power supplies and swapped the axis of inches and steps. I think this will be easier if I solve for x from a given form of quadratic equation such as: ax^2 + bx + c Also I re-measured all the distances and this time I checked them 3 times each to make sure that they weren't changing on me. The values are a little different since the power supplies have been meticulously adjusted. Please view the new graph copied from Excel. The new equation is now: y = 0.054x^2 - 11.84x + 656.4 I now solve for x directly with this equation... I think this is much simpler for me. Therefore, for a certain step value of 'x' I can solve the respective distance as y just by plugging in x in the above equation!!! So, based on the above equation, I have tried calculating certain coordinates as shown in my other attachments. I tried the following coordinates: (110,6) (125,22) (135,38) (137,54) I notice though that the higher I go in step wise 'x', the more error is in the distance??? I don't understand why this cannot be more precise??? Another thing is, what is the R2 in Excel's graph?? >>> Root #2 ??? The only thing is, if I try to solve for 150 steps... I would not know how off my distance is... cause I don't have enough room in my office to try such a distance LOL!!!! But given the amount of error in the above coordinates, I don't think I can trust this equation for greater distances than 54"... given the fact that already at this distance I am off 6 inches!! Also, in the Excel graph, which doesn't the line stretch til the last coordinate (137, 54) ?? In any case, if you can, please get back concerning these issues... It would be greatly appreciated! thanks so much for your assistance! Thanks all! Attached Thumbnails
Mentor
P: 9,614
 Quote by simpComp I don't understand why this cannot be more precise???

 Another thing is, what is the R2 in Excel's graph?? >>> Root #2 ???
It is a measure of the fit quality. R^2=1 would be a perfect fit, R^2=0.941 shows that your data deviates from the fitted function.

 Also, in the Excel graph, which doesn't the line stretch til the last coordinate (137, 54) ??
It is plotted up to 137 and the corresponding y-value. You can extend this manually in Excel.

It would be useful to know more about your data source. What do you test/measure? Is there any reason to expect a quadratic formula, or something else?
P: 44
Hello mfb,

 It is plotted up to 137 and the corresponding y-value. You can extend this manually in Excel.
I tried to click on line and then select the last plotted dot and tried to drag it to the non-plotted dot... but that didn't work ???

 It would be useful to know more about your data source. What do you test/measure? Is there any reason to expect a quadratic formula, or something else?
Well, one thing I just noticed, it seems to have to do with Excel!!!! Consider the following graph which I altered a little... It almost pretty much gives a linear line... but its not...
its still a parabola.

However when I use the suggested equation to calculate y for the first point (6, 109) the result is 0.451 " ??? Which in respect to the graph is totally erroneous!!!

Bof!!! we are supposed to come close to 6"
You can try it yourself !!!

Weird!

Here is what I tried:

y = 0.009x^2 - 0.272x - 76.83
y = 0.009(109)^2 - 0.272(109) - 76.83
y = 0.451 ????

Thanks!
Attached Thumbnails

Mentor
P: 9,614
 Quote by simpComp I tried to click on line and then select the last plotted dot and tried to drag it to the non-plotted dot... but that didn't work ???
Well, this is not an Excel help forum, and I don't even know which version you use, but you could try this:
Right-click on the fitted line -> "format trend line" -> "trend line options" -> "forward" -> 2.0 (or other values)
I translated the labels to english, the real names might be different.

 However when I use the suggested equation to calculate y for the first point (6, 109) the result is 0.451 " ??? Which in respect to the graph is totally erroneous!!!
That is a result of the finite precision of the given equation - try formulas like
y = 0.0092x^2 - 0.272x - 76.83
y = 0.0094x^2 - 0.272x - 76.83
They all get rounded to 0.009, but give different results if you compute values based on this equations. You can reduce this problem if you use "distance-100" instead of distance in your graph.
HW Helper
P: 2,692
 Quote by mfb Simple: Your data does not follow a parabola. It is a measure of the fit quality. R^2=1 would be a perfect fit, R^2=0.941 shows that your data deviates from the fitted function. It is plotted up to 137 and the corresponding y-value. You can extend this manually in Excel. It would be useful to know more about your data source. What do you test/measure? Is there any reason to expect a quadratic formula, or something else?
Exactly! Back in my post #9, a suggestion is made that higher order polynomial fit may give better results. I also tried an exponential fit but the resulting model with found values was bad.
 P: 44 Okay guys... this is what I have came up with! I played around with the first coefficient and the values are pretty close. Please view the attachment! Row "K" holds my steps and "L" holds my respective distances actually tested. Row "O2" to "O11" holds the values actually calculated by the equation. Note, row "O1" holds the first term coefficient which I played with in order to get the best results possible. So the whole equation I will enter in my program will be: f(x) = 0.000731x^2 + 1.619x + 175.6 I have done the tests up to 120" and the equation pretty much holds +/- 2" tolerance. I can't do any physical tests passed 120" b/c my room is too small LOL!!! I could try to rely on the equation for distances greater than 120" but I don't know how precise this will be... According to formula if I have 190 steps I would have a distance of 158.3" !!!! But in any case, for now, if the distance is passed the 120" mark, I will just indicate on my screen: "> 10 feet" ... step 158 gives a calculated distance of 98.4" which is the only one that is a little more off than the others (should be 96"). According to this chart of values, how can I specify the error tolerance factor? Can I take the reading with the most error.. for example the 98.4" is the one with the most error, can I express it this way: Error tolerance worst case scenario: 2.4"/120" = 0.02 or 2% error max Anyways these tests were done with a solid object. Tomorrow, I will have to try it with a human hand. I expect a different equation since infra-red goes through the human hand and results in less infra red bouncing back to the sensor!! Attached Thumbnails
 HW Helper P: 2,692 You are now using a function, f(x) = 0.000731x^2 + 1.619x + 175.6, with such a small coefficient on x^2, and your graph image in the attachment looks like a line. You seem to have an interval of steps for which a linear model will work very, very well. Below ~110 steps, your model may need to be a curve.
 P: 44 well, I don't need any measurements below 107 steps!!! I will look into using a linear model... thanks for your help

 Related Discussions Precalculus Mathematics Homework 9 Calculus 7 Precalculus Mathematics Homework 10 Precalculus Mathematics Homework 2 Introductory Physics Homework 10