Otherwise the it cannot be solved in terms of elementary

(high-school) functions.

Best regards.

]]>Put your known variables into Excel in cells A2:A5 (F,Y,D,V in that order – just because that’s the order they cropped up in the formula), you’ll have to make something up for D, then in A1 type the formula in:

=(3.07*A2*A3*(1+1.4*(A4/A5)*EXP(-2*A4/A5)))/(A4^2)

With A1 highlighted, go to Tools > Goal Seek. Set “to value” to what you want Q to be, and “by changing cell” to A4, and it will give you an approximation to about 3 or 4 dp.

]]>“*People are, in this case, correct. Variables in a linear term and an exponential term are rarely solvable algebraically.*“

Jason’s code iterates until two consecutive values of the sequence (x0 & x1) are close enough (10^-6 in his code) to be considered a solution X. But X=-2*D/V (see comment #25) so D=-X*V/2

]]>

import math

def distance_for_luminance(Q, F, Y, V):

__# set up some stuff

__c = 3.07 * F * Y / Q

__a = 1.04 / V

__f = math.exp(-2.0/V)

__# start with a terrible guess

__D = math.sqrt(a)

__# A whole bunch of times ("more than enough"),

__for i in xrange(10000):

____# Turn the good guess into a better guess

____D_new = (c / D) + a*c*(f**D)

____# And adopt the better guess as our new value

____D = D_new

__return D

]]>Daniel and Jason are both relying on a magic trick, the “iterative solution”: find an alchemy turning a good guess into a better guess. If you find such an alchemy and invoke it on a reasonable guess many, many times, you can find a result as close to the true answer as you have patience and bits.

Here is a working python function:

import math

def distance_for_luminance(Q, F, Y, V):

# set up some stuff

c = 3.07 * F * Y / Q

a = 1.04 / V

f = math.exp(-2.0/V)

# start with a terrible guess

D = math.sqrt(a)

# A whole bunch of times ("more than enough"),

for i in xrange(10000):

# Turn the good guess into a better guess

D_new = (c / D) + a*c*(f**D)

# And adopt the better guess as our new value

D = D_new

return D

```
```I think you'll have to reinsert indentation.

Now, you may not believe in this magic trick, and why should you? (A mathematician can tell you why, and when, that's what Grad School is for, but never mind.) The beauty is that you don't have to trust the method: a true solution speaks for itself.

`Perhaps by iteration, or perhaps from a whisper by the goddess Namagiri into your ear as you slept, just plug all values into both sides and `

*see* how far off it is.

Note that the domain of D is strictly positive; even including D=0 doesn’t introduce much difficulty. Glancing at the original function for Q, it definitely looks to be strict-monotonically decreasing, which should imply the existence of an inverse function over its range. (Existence doesn’t say anything about how to construct it, however.)

@Meyers:

Regarding the iteration, think of it as making a guess (x_0), then using that guess to make a *better* guess (e.g. going from x_n to x_{n+1}).

So:

var x0 = -Math.sqrt(a);

var x1 = -Math.sqrt(a*(1 – 0.7 * x0 * Math.exp(x0)));

while (Math.abs(x1-x0) > 1e-6) {

x0 = x1;

x1 = -Math.sqrt(a*(1 – 0.7 * x0 * Math.exp(x0)));

}

alert(x1);

That would be some JS to quickly calculate my re-parameterized value of x. (Of course, x=-2*D/V, so you are actually interested in D=-x1*V/2.)

[Fished this version of the comment out of the spam filters and restored it. Sorry about that, Jason! -E.]

]]>And Daniel’s i is just to express that repeating the assignation below 1000 times you’ll get an accurate enough solution

]]>Like, at the end of your comment, you do a “for i in” operation with no actual i in the equation, which has the solve-for term D on both sides of the equation. At which point my brain shorts out. Sorry.

I think maybe all the brain cells that would normally go toward understanding that kind of thing are currently devoted to holding a functional copy of the CSS line layout model.

]]>You can’t avoid iteration. But the recurrence I already suggested is way simpler than the bisection method. Here is the core of it:

c = 3.07/1.4*F*Y*V

d = -Q*V/1.4

f = math.exp(-2.0/V)

D = 0.0

for i in xrange(1000) :

D = -c/(d*D+f**D)

Or try Jason’s recurrence, it’s mostly the same.

]]>When D = 0, Q is undefined.

When D > 0, Q is positive.

When D < 0, Q is negative.

I don’t know where you got your equation, but the derivative of the equation at the top of the post is undefined at D = 0. Therefore, the function is not continuous.

The function may be solvable for only positive values of D, but I have no idea how to do that.

]]>Incidentally, for those who are curious:

Q = radiant energy (cal/cm^2)

F = thermal partition (unitless)

Y = yield (KT)

V = visibility (miles)

D = distance (miles)

So it’s easy (relatively speaking) to calculate the radiant energy at a given distance. I had assumed that the inverse, finding the distance at which one find a given radiant energy, was a matter of reshuffling. Kind of frustrating to find that’s not so.

Thanks for all the effort and input, folks!

]]>QV = (3.07FYV / D^2) + ((4.298FY / D) * (e^-2)^(D / V))

or if you prefer

Q = (3.07FY / D^2) + ((4.298FY / D^2) * (D / V) * (e^-2)^(D/V))

The exponentials are getting to me :(

]]>