PDA

View Full Version : Solving an equation



Sticks
2010-Mar-27, 12:13 PM
I have an equation of

y = 0.0009x2 - 0.2006x + 127.74

What is the best way of solving this, so given a value of y, I can get x

I suspect I may have done this at high school, but that was ages ago.

The values of Y I want to plug in are 112, 106 and 78

Any clues?

Do I need to go to differential calculus?

Nowhere Man
2010-Mar-27, 12:19 PM
The quadratic formula (http://en.wikipedia.org/wiki/Quadratic_equation#Quadratic_formula) will suffice. Plug in your values for y, rearrange so that the formula = 0, and have at it.

i.e., 0 = 0.0009x2 - 0.2006x + (127.74 - 112), dump your values for a, b, and c into the quadratic formula, and your two values for x will appear.

Fred

grapes
2010-Mar-27, 12:48 PM
I have an equation of

y = 0.0009x2 - 0.2006x + 127.74

What is the best way of solving this, so given a value of y, I can get x

I suspect I may have done this at high school, but that was ages ago.

The values of Y I want to plug in are 112, 106 and 78That's kind of a messy equation, I think, since the first coefficient is so small. I suspect it might be .00091 or .00089 or something. That sort of thing can cause headaches.
Do I need to go to differential calculus?To really understand that sensitivity, probably.

However, wolframalpha (http://www.wolframalpha.com/) will let you just play. :)

I typed in 112 = .0009 x^2 - .2006 x + 127.74 and it gave me back two complex roots. In fact, there is no number that gives real number solutions.

Sticks
2010-Mar-27, 12:58 PM
I just discovered that :doh:

I am graphing my weight loss and Excel generated that equation for the trend line. I was wondering how long before I got to certain target weights.

This does not bode well

I thought weight loss would follow a linear path, does the fact there is a coefficient for x2 mean I am doing something wrong?

Sticks
2010-Mar-27, 01:07 PM
Incidentally when i did differentiate that equation and put dy/dx to 0 it gave me a value of 116.4 or something along those lines, meaning I would never get below that weight.

:(

Tog
2010-Mar-27, 01:38 PM
I typed in 112 = .0009 x^2 - .2006 x + 127.74 and it gave me back two complex roots. In fact, there is no number that gives real number solutions.
As a personal exercise it tried to set up the formula in Excel, I was fine until the last set of numbers, then I got an error for taking the square root of a negative. I figured I just made a mistake I couldn't figure out how to fix.

PraedSt
2010-Mar-27, 01:43 PM
If you could let us know what x and y stand for, that would help. And if you could give the x values too...(x1, 112), (x2, 106), (x3, 78).

If the xs are constant length time periods, and x1, x2, x3 are periods 1, 2 and 3, I think you're losing weight at an increasing rate.

grant hutchison
2010-Mar-27, 01:53 PM
I thought weight loss would follow a linear path, does the fact there is a coefficient for x2 mean I am doing something wrong?If you want a linear trend, use Excel to find the best-fit linear trend.
I suspect allowing higher-order terms will provide no more useful information. And, of course, one should always be wary of extrapolation. Your current weight loss will contain very little useful information about the lowest weight you can (or should!) attain.

Grant Hutchison

Delvo
2010-Mar-27, 02:17 PM
Don't expect weight changes to follow an equation at all. In real life, people routinely find that the rates of change fluctuate a lot even if the people trying to work on it don't change any behaviors that they're aware of. If you plot the points on a graph and trace a line/curve through them, you'll see multiple convexities and concavities, conforming to no equation at all but just tracking changes that happened in history, like those graphs they publish in articles on stock market activity.

Following it too closely can even be counterproductive, if you get discouraged by an apparent lack of results for high effort one week or get complacent due to apparently great results for little effort the next week. Just know that it will change unpredictably & seemingly randomly, and don't think too much about the changes.

peter eldergill
2010-Mar-27, 02:17 PM
I would guess a wight loss curve would follow some sort of exponential decay curve

Pete

Chuck
2010-Mar-27, 03:05 PM
If your weight loss is imaginary then you need a different program.

Cougar
2010-Mar-27, 04:15 PM
I typed in 112 = .0009 x^2 - .2006 x + 127.74 and it gave me back two complex roots. In fact, there is no number that gives real number solutions.

None of Sticks' numbers for y do. But if y > ~116.57, you start getting real number solutions.


The values of Y I want to plug in are 112, 106 and 78...

You don't really want to weigh 78 lbs, do you? :rolleyes:

Sticks
2010-Mar-27, 04:29 PM
If you could let us know what x and y stand for, that would help. And if you could give the x values too...(x1, 112), (x2, 106), (x3, 78).

If the xs are constant length time periods, and x1, x2, x3 are periods 1, 2 and 3, I think you're losing weight at an increasing rate.

X = days since I started the regime

y = weight in kilograms


I'll probably regret sharing this personal information, but my attempt at dropping my mass is due to a recent diagnosis of Type Two diabetes:

first graph is of the weight readings from two different scales, the ones at the doctor surgery and one at a place called the Weigh House at Grainger Market in Newcastle upon Tyne.

Day zero was 20 January 2010


The second graph is a plot of all weight readings, the doctors surgery and Grainger Market. It is this graph where Excel gave me a trend line and came up with that quadratic equation I unsuccessfully tried to solve. :doh:

The aim was to get a weekly reading, but some days I weigh myself on a Saturday and sometimes it has been a Friday, especially if I will not be able to get there on a Saturday. There was one reading taken the day after I got a reading saying I had put on weight and over night I dropped by 800g. This week I had an extra weighing session on a Wednesday as I was due to see the dietician on the Thursday and wanted evidence I had been making an effort. The dietician has told me to only weigh myself once every two weeks and not every week as I have been doing. :confused:

The third graph was prepared by my sister who created a line based on an assumption of what is recommended weigh loss, and she came up with a lower figure than the dietician as to what my target weight should be. (She did the lighter life diet)

I have also included two photos, one of my face before I started loosing, used currently as my avatar and one taken a few minutes ago on my webcam. I am told you can see a difference.

Moose
2010-Mar-27, 04:50 PM
Sticks, having had to reduce my weight in the past ("or else"), I'll just give you a few pieces of advice:

So when you do measure, use the same scale. (You're measuring difference in weight, not absolute weight.) Any scale will do, just make sure it's the same one. If you use a different scale, track it separately.

Be in the same state of dress (approximately) every time you measure, meaning if you weigh in with your shoes, jeans and wallet the first time, wear your shoes, jeans and wallet the next.

And your dietitian is right. Every two weeks. No sooner. Measurement inaccuracy is significant enough that you don't want to be fretting over what appears to be a slight increase or decrease caused by your precise foot placement. In two weeks, if you're on the right track, you can expect the two measurements to be statistically different.

I'll add this to your dietitian's advice: Measure on the same day of the week, at the same time of day, after you've used the can and before you've eaten or started in on the morning coffees. Your body weight will fluctuate considerably during the course of a day. (Remember: 1 liter of water weighs about 2.5 pounds.)

The idea is to control as many variables as you can. You want to measure the differences in the weight of your hull, not the differences in the weight of your cargo.

The other thing to remember is that as you get active, your body is building muscle tissue while it's burning fat tissue. Muscle tissue is denser than fat tissue, and so your weight isn't going to drop much for the first month or two. Pay attention to your belt at first, because weight loss in guys shows up there before it shows up on the scales.

[Edit: And yeah, you can see a noticeable difference between your face then and now. Congrats.]

DonM435
2010-Mar-27, 05:08 PM
Maybe the intent of the complex formula is to make you sweat off a few pounds in solving it. :confused:

Sticks
2010-Mar-27, 05:11 PM
If I can get measured on a Friday during my lunch hour I do endeavour to make sure I am wearing the same or similar clothes and I remove everything from my pockets, remove my watch and socks and shoes. I also make sure I have eaten and drunk exactly the same thing earlier and use the toilet before I go and get weighed, just to try and make sure I get consistent data.

And for the record, on this web page (http://www.travelblog.org/Photos/4394131) you can see an image of the scales I am using at Grainger Market.

grapes
2010-Mar-27, 05:30 PM
I suspect allowing higher-order terms will provide no more useful information. And, of course, one should always be wary of extrapolation. Your current weight loss will contain very little useful information about the lowest weight you can (or should!) attain.What it says is that he is losing weight, but not as fast as he once was. The slope of the quadratic was steeper, now it's not as steep. If it follows a quadratic, it'll bottom out, and start back up.

Two options, either fit a straight line to what has gone before (it'll be decreasing, but biased a bit by the greater loss from earlier), or take the current slope and extrapolate that as a straight line.

Sticks, you could just wait and see, but sometimes it is good to set goals--and this is one way of doing that.

PraedSt
2010-Mar-27, 06:01 PM
...

Sorry to hear about your diabetes Sticks.

From the second graph: the equation gives you imaginary roots because the curve never crosses the x-axis, i.e. you'll never reach 0 kg (a good thing too!). And your three targets of 112, 106 and 78 don't work because, as you rightly calculated, the minimum for the equation is ~116 kg.

This does not mean that you'll never get below 116 kg! As others have pointed out, forecasting weight loss is fraught with difficulties. And don't pay much attention to what a quadratic comes up with. If you followed it exactly, you'd hit 116 kg and then start putting on weight. :)

I'd stick to a linear trend like the graph your sister produced. It's accuracy is a better fit to the 'randomness' of the process you're trying to model.

Besides, looking at the linear graph, it's obvious that you've made progress and also that you're on the right track. I think you've lost ~ 1 kg per week? That's a good, healthy rate of weight loss.

peter eldergill
2010-Mar-27, 06:03 PM
Heh...Sticks I also thought you were measuring in lbs. Then I saw that you were concerned at weighing no less than 116 lbs and I thought, wow, that's really unhealthy to weigh that little, why would he want to do that.

Now that I know it's kilos, that makes much more sense to me now!

Funny in Canada, we measure pretty much everything in metric, but most people still measure personal weight in lbs and height in feet/inches. That might be changing with the younger generation but I certainly don't know my weight in kilos or height in cm (and I'm only 38..but stay off my lawn!!)

Good luck Sticks (and don't regret sharing that personal info, everything you've said in the thread now makes more sense to me and I'm sure to others)

Pete

mugaliens
2010-Mar-28, 06:45 AM
[QUOTE=Sticks;1707059]I have an equation of

y = 0.0009x2 - 0.2006x + 127.74

What is the best way of solving this, so given a value of y, I can get x

I'd try here (http://id.mind.net/~zona/mmts/miscellaneousMath/quadraticRealSolver/quadraticRealSolver.html).

This was the result:

http://i35.photobucket.com/albums/d185/mugaliens/Quadratic.jpg

It's only 40 k, less than a second at modem speeds, so...

grapes
2010-Mar-28, 02:32 PM
This was the result:

::snip::

It's only 40 k, less than a second at modem speeds, so...That's for a weight of y = zero kilograms. Sticks probably will be satisfied with a little more mass than that. :)

tdvance
2010-Mar-28, 06:05 PM
I have an equation of

y = 0.0009x2 - 0.2006x + 127.74

What is the best way of solving this, so given a value of y, I can get x

I suspect I may have done this at high school, but that was ages ago.

The values of Y I want to plug in are 112, 106 and 78

Any clues?

Do I need to go to differential calculus?

with coefficients like that, the quadratic equation is the best route.

jfribrg
2010-Mar-29, 04:46 PM
Because the coefficients are so small, perhaps the real purpose of the problem is to encounter propagation of rounding errors.

Sticks
2010-Mar-29, 04:58 PM
Out of interest does Excel give error bars?

Nick Theodorakis
2010-Mar-29, 05:42 PM
Out of interest does Excel give error bars?

Yes, depending on what you mean by error bars. It will calculate standard deviations and you can add error bars to data points on charts.

Nick

PraedSt
2010-Mar-29, 05:55 PM
Out of interest does Excel give error bars?

As Nick says, yes. For the charts: select the series > right click > format data series > y error bars tab.

mike alexander
2010-Mar-29, 07:38 PM
Ah, now that I plotted it I understand a bit better.

The quadratic is not a great candidate for this because you are using a portion of the complete function. Is you extrapolate far enough out you will see the curve starting up again. It does not approximate the functional idea of a number decreasing sort of asymptotically to a final value.

An inverse power function might not work too badly. Something like
y=a/xn where n is < 1.

Sticks
2010-Apr-12, 11:23 AM
Last Friday when I took a reading, my weight was up by 300g, the following day it dropped by 900g. I followed the same eating protocols both days.

Am I looking at a trendline signal with a lot of noise?

HenrikOlsen
2010-Apr-12, 12:28 PM
In short, yes.

During a normal day your weight can easily swing a kilo, which is why the first rule of weighing if you do ti every day is to do it at the same time every day, otherwise your result is meaningless. (and for every day measurements it still comes close to meaninglessness)

You wouldn't try to draw a curve of how the average temperature of the days rise due to spring by measuring at different times each day either.

If you're really interested in the noise, try to record data points before and after each meal and toilet visit, and use them either as actual data points, with tihe real time in the plot or to put error bars on your daily values.
Do it a couple of days and you'll have an idea about how large the noise in the measurement is and know that if you plot your weight you may as well do so with ad-hoc +/- 1kg or larger error bars.

That will likely also make your curve fitting feel more comfortable as you can see how it actually fits within the inherent error of weight measuring (which isn't affected much by the precision of the scales).