Google Answers Logo
View Question
Q: Solving for a value ( Answered,   1 Comment )
Subject: Solving for a value
Category: Science > Math
Asked by: trainguy-ga
List Price: $25.00
Posted: 18 Jun 2004 10:02 PDT
Expires: 18 Jul 2004 10:02 PDT
Question ID: 362996
This is an (I think) simple math question. Basically, my college math
from many years ago is fading into the mists of time, and I can't
create the necessary mathematical conversions.  This relates to
calculating the power needs for a moving vehicle. Forgive my choice of
notation, it's really only the mathematical aspects I'm concerned
about anyway, the actual values etc are irrelevant.

Aerodynamic power needs are defined as:

 Pa = Coefficient of drag (Cd) x frontal area/2 x air pressure  x V3

Rolling power needs are:

Pr = Coefficient of rolling resistance (Cr) x V x weight x Gravity (G)

Finally, the incline power needs (what it takes to pull up a slope):

Ps = Sin (angle) x G x weight x V  
Add it all up, and Total power needs are:

P = (Cd x frontal area/2 x air pressure  x V3) + (Cr x V x weight x G)
+ (Sin (angle) x G x weight x V)

I want to reverse all that last equation now, and knowing everything
else, determine V.

Request for Question Clarification by smudgy-ga on 18 Jun 2004 10:17 PDT
Hi trainguy,

In the first equation, what does V3 represent? Is this three times V,
or is this some other variable?

Secondly, if we solve for V, the equation will necessarily be in terms
of P. Is this in line with what you are expecting? If you know neither
V nor any of the P values, you will not be able to solve the equation.

Clarification of Question by trainguy-ga on 18 Jun 2004 10:21 PDT
Hi smudgy

Sorry, the notation I used before I pasted the problem messed it up
slightly.  V3 is V cubed (V^3)

Also, I know the cumulative P, in ohter words the P in the last
equation.  Idon't necessarily know the individual components (Pa, Pr,
or Ps in my notation)

Hope that helps

Request for Question Clarification by smudgy-ga on 18 Jun 2004 10:50 PDT
Hi trainguy,

The "cubed" in your problem changes this from a relatively
straightforward problem to one that is surprisingly challenging, since
we now have to factor a cubic equation. There's generally no
convenient way to do this by hand, but a computer algebra system
should be able to do so. If I solve the problem on a computer algebra
system, I will not be able to show you a step-by-step process for
converting the equation from one form to the other, though I should
still be able to get an equation solved in terms of V. Would this
still be acceptable to you?


Clarification of Question by trainguy-ga on 18 Jun 2004 10:58 PDT
Hi smudgy,

It's the V^3 that threw me, to be honest.

Well, exactly how you figured OUT the answer isn't important. I don't
need a step by step progression.   However, I can't (for instance)
give you a set of numbers and ask for the answer.  This is part of a
rather large spreadsheet application, and I need to be able to have a
formula that can be inserted into a long series of cells, solving 'on
the fly' so to speak.

Does that sound do-able?

Request for Question Clarification by smudgy-ga on 18 Jun 2004 11:01 PDT
I could use a computer algebra system to solve the equation for V, and
keep it in terms of variables. It might take a bit to track down an
available computer with a CAS on it, but it should get you the
solution you are looking for. Once you have the equation V=, in terms
of variables, you ought to just be able to plug that straight into
your spreadsheet.

Give me a while to track down an available computer. If I can't find
one in the next, oh, day or so, I'll turn this over to another

Request for Question Clarification by smudgy-ga on 18 Jun 2004 11:26 PDT
Hi again trainguy,

I have the equation for you, but boy is it messy. There are a few
options we have... if you give me your variable names, I could try to
rewrite the solution as an excel equation, or I could simply copy out
what I have gotten from Mathematica and upload it as an image. I might
be able to export it as a LaTeX equation as well. What do you think is
the best route?


Clarification of Question by trainguy-ga on 18 Jun 2004 11:59 PDT
Hi smudgy, that was fast.

I think, since my own formulas are messy as well, such that some of
the simple vraiables I gave you actually appear much more complicated,
that simply giving me what you've received from Mathematica is
probably best, and I'll spend the time to decipher and translate it. 
Thank god for Excel's dragging capabilites is all I've got to say...

Does that work for you?
Subject: Re: Solving for a value
Answered By: smudgy-ga on 19 Jun 2004 06:58 PDT
Hi Trainguy,

I hope you find the following answer satisfactory. If you have any
questions, or problems opening files or interpreting notation, please
let me know before rating and I will do my best to resolve any
difficulties you are having.

I have the equation for you uploaded as a bitmap file. Because I
realize this may not be easily viewable for you, I will also embed the
image in an excel document.

Here is the bitmap:

And here is the excel file:

In this equation, I used the following notation:

Cd = Coefficient of Drag
fa = Frontal area
ap = air pressure
Cr = Coefficient of rolling resistance
w = weight
G = gravity
t = angle
P = total power

Note that there is a negative sign at the very front of the formula,
which might be easy to miss in the image. Also note that variables
with a space between them are being multiplied.

Here is how I solved the problem:

Using Mathematica computer algebra software, I asked the program to
solve the original equation for the variable V:

Solve[P ==
(Cd * (fa/2) * ap * V^3) + (Cr * V * w * G) + (Sin[t] * G * w * V), V] 

Mathematica gave me three solutions, but two of those involved
imaginary numbers, and were discarded. The third solution, simplified
somewhat using Mathematica's Simplify[] function, is the one provided
in the files above.

Mathematica is an extremely powerful piece of software that can
perform an incredible number of complicated symbolic mathematical
functions. I'd highly recommend it if you are going to be coming
across a lot of these types of problem. Other software, such as Maple,
have similar capabilities. Programs of this sort are known as
"Computer Algebra Systems".

Suggested google searches:
Maple computer algebra
computer algebra systems

Mathematica is published by Wolfram Research,
Maple is published by Maplesoft,

For more information about solving cubics and other polynomials, do a
google search for:
polynomial solving
polynomial factoring
cubic solving
cubic factoring

I hope you find this answer satisfactory. Once again, do not hesitate
to ask for a request for clarification if you are having problems with
the formula.


Clarification of Answer by smudgy-ga on 19 Jun 2004 19:56 PDT
Hi again trainguy,

Mathtalk makes a good point in his comment about Newtonian iteration.
This can very rapidly (and somewhat more simply than the equation I
provided) give us a very good approximation of the correct value of V,
and in your application it may be a feasible alternative to simply
using a big collection of variables to get an exact value of V.

I will provide more information about implementing Newtonian iteration
shortly, hopefully by the end of the day tomorrow. Meanwhile if you
have the opportunity, feel free to let me know if the formula seems to
meet your needs (I'm of course happy to provide both methods even if
you decide the formula already given suffices).


Request for Answer Clarification by trainguy-ga on 19 Jun 2004 21:22 PDT
Hi smudgy,

Unfortunately, I'm away from my computer that has my main spreadsheet
on it, so I'm unable to check out your answer until Monday morning my
time (North American Pacific Daylight). It looks like quite the
formula, but until I can insert sme representative numbers, I can't be
sure if it's going to work, although i assume it will.

I would certainly be interested in mathguy's appraoch, if you think it
has merit.  You are correct in assuming I'm not looking for incredible
accuracy.  In the units I'm using, V should resolve to km/hr, and
single or at most double decimal accuracy is probably fine for my

That said, you're in line for a good tip on this one, I think you're
doing a huge amount of work for my measly $25.  Many thanks.

Clarification of Answer by smudgy-ga on 20 Jun 2004 03:49 PDT
Hi again Trainguy,

In order to get the most out of the Newtonian iteration method, the
following information would be helpful: Are Pa, Pr, Ps, or indeed any
particular ones of the variables likely to be negative in your
computations? This will not stop the iteration method from working,
but it may change the approach we take to automate the procedure.


Request for Answer Clarification by trainguy-ga on 21 Jun 2004 07:31 PDT
Hi again smudgy,

Yes, indeed, Ps is negative in some situations (downhill slopes).
Specifically, it's the Sin(angle) ((Sin(t) in your notation)that has a
negative value.  All the other variables should have positve values

Clarification of Answer by smudgy-ga on 21 Jun 2004 13:37 PDT
Hi again Trainguy,

The Newtonian iteration method works like this:

Define a function f(V) = V^3 + aV - b

where a = (2(Cr+sin(t))*(w*G))/((Cd*fa*ap)
and   b = 2P/(Cd*fa*ap)

When this function equals zero, it is equivalent to having solved for
V in our original equation,
P=Cd*(fa/2)*ap*V^3 + Cr*w*G*V + sin(t)*G*w*V

So our goal is now to find for what value of V does f(V) equal zero.

We do this with an iterative procedure. Given a "guess" as to where
f(V) might equal zero, we can use derivatives and tangent lines to get
a guess that is considerably closer to the actual value where f(V) is
zero. We will then use the procedure again on our new guess. Lather,
rinse, repeat, until f(V) is as close to zero as we want (we can plug
our guess for V into f(V) to see how close to zero we are getting).

Here is how we start guessing. Let a and b be defined as above.

Then f(V) = V^3 + aV - b

Our initial "guess" for V (call it V_0) will be

V_0 = squareroot(|a|) + cuberoot(|b|)

This number is chosen in such a way to ensure that we close in on the
correct (positive) root of the cubic equation. It may be quite far off
from the actual answer, but the iterative procedure will close in on
the correct answer very quickly.

Now, we will generate a new "guess" for V by plugging V_0 into the
following equation:

V_1 = V_0 - f(V_0)/(3(V_0)^2 + a)

This guess V_1 will be considerably closer to the correct value of V
than our original V_0 was.

Now, repeat the process above, using V_1 as the input (instead of V_0)
and calling the output V_2. This will yield an even closer
approximation of the correct value of V. We can repeat this as often
as we want, each time generating a new guess V_n and checking how
close we are to the correct answer by seeing how close f(V_n) gets to
zero. When |f(V_n)| <= 0.00000001, for example, our guess for V is
exceedingly close to the correct answer.

Here is a visual basic script, courtesy of mathtalk-ga, that performs
the process. Note that the code is given in terms of variables a and

--- Begin mathtalk's code ---

Function custNewton(a As Double, b As Double) As Double
Dim v, f As Double

v = ((Abs(a) ^ (1/2)) + ((Abs(b) ^ (1/3))

f = v * (v * v + a) - b

Do While Abs(f) > 0.00000001
    v = v - f / (3 * v * v + a)
    f = v * (v * v + a) - b

custNewton = v

End Function

--- end mathtalk's code ---

We can change the precision of our approximation by making the number
0.00000001 bigger or smaller--the smaller the decimal (i.e., the more
zeroes) the more accurate our solution will be.

I can explain to you in more detail why this process works, if you
want, or you can read more about it by searching for "Newton's
Method." Some derivative calculus is involved. Or, for a visual
example of what's going on with the process, check out the nice java
applet at

Many thanks to Mathtalk for his extensive help with the approximation
process and code.

Once again, if you are having any problems with this, please don't
hesitate to request a further clarification.

Good luck,
Subject: Re: Solving for a value
From: mathtalk-ga on 18 Jun 2004 16:54 PDT
My suggestion would be to program a user-defined function in Excel VBA
that solves these cubic equations numerically by a custom Newton
iteration.  This would be quite efficient, unless by extremely bad
luck one happens to have a root of multiplicity > 1.

regards, mathtalk-ga

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy