Previous in Forum: Wireless Drivers Advent Modena M200 Blue   Next in Forum: Reply Email in iPhone 4
Close
Close
Close
36 comments
Rate Comments: Nested
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468

Rearranging a Function to Find X

12/23/2010 4:33 AM

If there are any maths wizards out there who fancy giving me a leg up re-arranging this expression, I'd very much appreciate it.

The function I have is:

D(x) = Ax-2.e-Bx

... and I'd like to re-arrange it to find x as a function of A, B and D.

This is being done on a PC, and I could do it numerically, but it would be more elegant to have a nice expression to give me the solution directly.

What I actually need to be able to do is find what value of x gives me a particular value of D.

A and B are just constants.

Thanks in advance for any help.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Good Answers:

These comments received enough positive votes to make them "good answers".

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#1

Re: Re-arranging a function to find x

12/23/2010 5:15 AM

Awwwwww mrooooowlllll, my brain hurts.
Sorry no help, but have a Merry Christmas.
Del
(I only peeked 'cos I thought it might be a Chrissy joke post)

__________________
health warning: These posts may contain traces of nut.
Register to Reply Off Topic (Score 5)
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#2
In reply to #1

Re: Re-arranging a function to find x

12/23/2010 5:19 AM

No worries (as they say in the antipodes) - thanks for looking.

Merry Christmas back at ya.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply Off Topic (Score 5)
3
Guru
Engineering Fields - Optical Engineering - Member Engineering Fields - Engineering Physics - Member Engineering Fields - Systems Engineering - Member

Join Date: Apr 2010
Location: Trantor
Posts: 5363
Good Answers: 647
#3

Re: Rearranging a Function to Find X

12/23/2010 9:09 AM

Yikes. Good luck. The x-2 term gives you an asymptote at x=0. Needless to say, having both an x-2 term and a e-Bx term in the same equation makes it tough. You could take the log of both sides and get log(D) = log(A)-2log(x) - Bx, ... but ugh.

If you remove the x-2 term, the revised equation is similar across the range -10 to 5... but without the singularity at 0, with A2 being 1% of the original A. Here are the equations with A=1, A2 = 0.01 and B=1.

__________________
Whiskey, women -- and astrophysics. Because sometimes a problem can't be solved with just whiskey and women.
Register to Reply Good Answer (Score 3)
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#4
In reply to #3

Re: Rearranging a Function to Find X

12/23/2010 9:47 AM

Thanks mate, nice one. Is that MathCAD? - I don't have .

Actual values are a bit different to your assumptions:

0.5 < x<5 (so no need to fret about the singularity),

A ≈ 10

B ≈ 0.001

The exponential term is just a small correction (to what's basically an inverse square law), but it's important to the end user.

I tried taking logs, but (as you found) it gets just as messy. Got a horrible feeling I'll end up with some kind of interative solution, after setting B to zero to get a first approx.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
Engineering Fields - Optical Engineering - Member Engineering Fields - Engineering Physics - Member Engineering Fields - Systems Engineering - Member

Join Date: Apr 2010
Location: Trantor
Posts: 5363
Good Answers: 647
#5
In reply to #4

Re: Rearranging a Function to Find X

12/23/2010 10:42 AM

Yes, it's Mathcad.

Is there a particular value for D you are trying to get? You imply that you know the value of D(x), and are trying to find the value of x for that D(x). Correct?

__________________
Whiskey, women -- and astrophysics. Because sometimes a problem can't be solved with just whiskey and women.
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#10
In reply to #5

Re: Rearranging a Function to Find X

12/23/2010 12:01 PM

I know the value of D for one specific value of x. The object is to be able to calculate x for any required value of D.

Might as well fill you in a bit more.

This is for use on a rig for calibrating radiation detectors. One of a number of radiation sources is exposed, producing a gamma ray beam which shines onto the detector which is mounted on a motorized trolley. Once a year or so, the doserate in the beam is measured at one specific point (the "calibration distance") using a secondary standard ionization chamber. This gives what's known as the "source term".

To be able to expose the detector to a specific doserate, the source term is first corrected for decay (using a simple calculation based on the half-life of the nuclide), then the required distance from the source to the dectector must be calculated.

The doserate falls off in the usual (inverse square law) manner, but there is also a small amount of attenuation due to photoelectric and Compton interactions between the gamma photons and the air.

The full expression for doserate is:

D(x) = Dc * (Xc/x)2 * e-μ(x-Xc),

where:

Dc is the decay-corrected "source term",
Xc is the calibration distance, and
μ is the air attenuation coefficient.

An interesting quirk is that for some low energy radiations, the sign of μ can change, making the resulting doserate higher than would be expected from just the inverse square law calculation.

In use, an operator selects a nuclide and types in a required doserate (or these are found from a protocol file for a particular instrument to be calibrated). The software then finds the most appropriate combination of radiation source and distance, moves the trolley to the correct position, moves the source into position and opens a shutter to start the exposure.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#31
In reply to #5

Re: Rearranging a Function to Find X

12/30/2010 5:02 PM

Many thanks for your help - including the pm's that others haven't been privy to.

(Jeez - I've ended a sentence with a preposition again! I'll be in trouble with the Grammar Police!)

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
Engineering Fields - Optical Engineering - Member Engineering Fields - Engineering Physics - Member Engineering Fields - Systems Engineering - Member

Join Date: Apr 2010
Location: Trantor
Posts: 5363
Good Answers: 647
#8
In reply to #4

Re: Rearranging a Function to Find X

12/23/2010 11:23 AM

By the way, if B = 0.001 then across the range from x = 0.5 to x = 5, the e-Bx term only changes value from 0.9995001 to 0.9950125.

So you could get an excellent approximation by simply setting the e-Bx term to K = 0.997 [or even just to K = 1.00]. Then solve D(x) = Ax-2·K for x. Easy as pi.

__________________
Whiskey, women -- and astrophysics. Because sometimes a problem can't be solved with just whiskey and women.
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#12
In reply to #8

Re: Rearranging a Function to Find X

12/23/2010 12:16 PM

Agreed - thing is that the B can have other values, and does just about become significant in some circumstances.

I was considering using a linear approximation (which would give a result much more accurate than many of the other uncertainties in the system), but thought it would be more elegant if I could show that the software's doing a "proper" calculation.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Anonymous Poster
#26
In reply to #4

Re: Rearranging a Function to Find X

12/29/2010 6:09 PM

MATHCAD(R), like other programs, can be powerful analytic tools, but maybe Excel(R) can help out until someone provides a more exact formula to answer your question. In the mean time, even though I didn't go to a theory-heavy school, maybe this can tide you over 'til then.

The basic equation is, essentially,: d = A(x^(-2)) * e^(-Bx), such that:

A = 10; B = .001; and 0.5 < x < 5.0 => one dependant, & one independant, variable

=> d solutions should be unique for each variable x => take natural logs of both sides

=> ln(d) = ln (Ax^(-2)) + ln( e^(-Bx) = ln(A) - 2 ln(x) - Bx

=> which yields quantifiable equations of the form;

ln(d) = ln(A= 10) - 2 ln(x = 0.5) - (B = .001) (x =0.5)

.

.

.

ln(d) = ln(A= 10) - 2 ln(x = 5.0) - (B = .001) (x = 5.0),

from which unique numerical values for e^(ln(d)) = d(x), can be calculated, which readily allow for interpolation to get the intermediate x-values.

This furthur suggests using Excel(R) to plot-out d(x)-vs-x, or better yet, to plot x-vs-d(x), which provides a graph from which to read-off the x-value from the d(x) curve, as was asked for in the original posting ...

Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#27
In reply to #26

Re: Musing about Rearranging a Function to Find X

12/29/2010 8:59 PM

Don't really understand why you bothered to take logs - the exponential function is available in Excel and also in most (if not all) programming languages.

The following isn't directly in reply to you, Guest (but thanks for the input anyway) - I'm just thinking.

Your post has suggested to me a very simple method of finding my answer.

  • I know that the smallest increment I need for x is 0.0001 (a consequence of the electromechanical system controlling the distance x from the origin).
  • Taking steps of x of 0.0001 in the range 0.5 < x < 5.0 gives 45,000 values.
  • All 45,000 values for D(x) could be computed in well under a second on a PC.
  • The function D(x) is well-behaved in this range.
  • Given this array of values of D(x), it would be very easy to find the appropriate value of x for any value of D between D(0.5) and D(5.0).

This may be the solution I adopt!

My muse is this:

Is the accessibility to "number-crunching machines" leading to a neglect of the study of mathematical methods?

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Anonymous Poster
#32
In reply to #27

Re: Musing about Rearranging a Function to Find X

12/30/2010 7:49 PM

We each approach a task with the particular tools which we have at hand at the time, and Excel(R) is what I have...

In any case, I am glad that I was able to be of assistance. Happy New Year, in any case...

Register to Reply
Guru
Hobbies - Musician - Engineering Fields - Chemical Engineering - New Member Engineering Fields - Control Engineering - New Member Engineering Fields - Instrumentation Engineering - New Member

Join Date: Jan 2007
Location: Moses Lake, WA, USA, Thulcandra - The Silent Planet (C.S. Lewis)
Posts: 4216
Good Answers: 194
#6
In reply to #3

Re: Rearranging a Function to Find X

12/23/2010 11:02 AM

I hate to be critical, but here you would use ln, not log.

Still, GA for the input and the workthrough on Mathcad. I'd like to get a license, but can't really justify the expenditure right now.

__________________
"Reason is not automatic. Those who deny it cannot be conquered by it. Do not count on them. Leave them alone." - Ayn Rand
Register to Reply
Guru
Engineering Fields - Optical Engineering - Member Engineering Fields - Engineering Physics - Member Engineering Fields - Systems Engineering - Member

Join Date: Apr 2010
Location: Trantor
Posts: 5363
Good Answers: 647
#7
In reply to #6

Re: Rearranging a Function to Find X

12/23/2010 11:11 AM

True, but really, 'log' is generic. Though ordinarily 'log' is considered to be 'log10' and 'ln' is 'loge', I didn't make the distinction since the equation had the e in it. I can see how someone might be confused since I was a bit causal about that. So, good point.

__________________
Whiskey, women -- and astrophysics. Because sometimes a problem can't be solved with just whiskey and women.
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#9
In reply to #6

Re: Rearranging a Function to Find X

12/23/2010 11:34 AM

I also tend to be a bit sloppy with the use of the word. I'm writing the code in VB, and the log() function actually returns the natural log.

(That's my excuse anyway ).

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
Hobbies - HAM Radio - New Member

Join Date: Oct 2006
Location: Vancouver (not BC) Washington (not DC) US of A
Posts: 1261
Good Answers: 12
#19
In reply to #3

Re: Rearranging a Function to Find X

12/25/2010 2:03 PM

Just a quicky... because we are working with ex be sure to use ln (natural log) rather than log10.

Bill

Register to Reply
Guru
Popular Science - Cosmology - New Member Engineering Fields - Civil Engineering - New Member Engineering Fields - Nuclear Engineering - New Member United States - Member - New Member

Join Date: Aug 2010
Posts: 714
Good Answers: 38
#11

Re: Rearranging a Function to Find X

12/23/2010 12:07 PM

Given that the unknown is both inside and outside a log, there is no expression directly for x.

Since it is being done on a PC, numerical methods are your best option! I don't remember them all, but I do remember that the Runge-Kutta (sp?) method was a pain to program, but is extremely efficient.

__________________
Sometimes my thoughts are in a degree of order so high even I don't get it...
Register to Reply
Guru
Popular Science - Cosmology - New Member Engineering Fields - Civil Engineering - New Member Engineering Fields - Nuclear Engineering - New Member United States - Member - New Member

Join Date: Aug 2010
Posts: 714
Good Answers: 38
#13

Re: Rearranging a Function to Find X

12/23/2010 6:08 PM

Again, no direct solution, but I just remembered a quick and simple numerical method... for your equation it would be the following

xn+1 = (1/B)*ln[D/(y*x2)]

Just plug in your particular D and a guess for x on the right side to compute the result. Use the result to plug back into the right side again... repeat. It will converge relatively quickly depending on the desired level of accuracy.

Hope it helps!

__________________
Sometimes my thoughts are in a degree of order so high even I don't get it...
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#14
In reply to #13

Re: Rearranging a Function to Find X

12/23/2010 7:27 PM

Thanks - I'll give it a try (if I can work out what 'y' is ).

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
Popular Science - Cosmology - New Member Engineering Fields - Civil Engineering - New Member Engineering Fields - Nuclear Engineering - New Member United States - Member - New Member

Join Date: Aug 2010
Posts: 714
Good Answers: 38
#22
In reply to #14

Re: Rearranging a Function to Find X

12/27/2010 10:03 AM

My apologies, I was in a rush on my last post. Here's the correction and the method.

xn+1 = 1/B*ln[ A / (D*x2) ]

If you take your original function and simply rearrange to solve for one "x" you can obtain an iterative solution to the function. That's all the above amounts to. To use it you simply enter in your known D(x) value and a guess for x on the right, compute the answer, and use that solution for the next iteration.

It is relatively quick (about half of the error is reduced each iteration).

__________________
Sometimes my thoughts are in a degree of order so high even I don't get it...
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#23
In reply to #22

Re: Rearranging a Function to Find X

12/27/2010 11:17 AM

Thanks again - will try it.

Just to save me having to think (still a bit foggy after sampling some of the things Santa's brought!) - I assume that's

xn+1 = [1/B]*ln[ A / (D*x2) ] ?

I was considering using a binary chop, or even a linear search - I know the attenuation corrected solution's within a couple of mm of the inverse square result, and I only need a result to 0.1mm, but this looks nice.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
Popular Science - Cosmology - New Member Engineering Fields - Civil Engineering - New Member Engineering Fields - Nuclear Engineering - New Member United States - Member - New Member

Join Date: Aug 2010
Posts: 714
Good Answers: 38
#24
In reply to #23

Re: Rearranging a Function to Find X

12/27/2010 11:30 AM

You have it correct.

There very well may be other solutions/methods that would converge faster. This was a "quick and dirty" method a professor taught me. The method doesn't always work, but in this case I tried it out in Excel and seemed to work great.

__________________
Sometimes my thoughts are in a degree of order so high even I don't get it...
Register to Reply
Guru
Engineering Fields - Nuclear Engineering - New Member

Join Date: Sep 2009
Location: Louisville, OH
Posts: 1925
Good Answers: 36
#15
In reply to #13

Re: Rearranging a Function to Find X

12/23/2010 11:53 PM

Earlier it sounded like the OP was worried about having an iterative solution. He also would like the solution to be elegant. Since some people seem to be unaware of iterative solutions, an iterative solution IS elegant.

__________________
Lehman57
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#17
In reply to #15

Re: Rearranging a Function to Find X

12/24/2010 4:20 AM

I did use the comparative - more elegant.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Anonymous Poster
#16

Re: Rearranging a Function to Find X

12/24/2010 12:41 AM

I hope this doesn't appear too silly and please correct me if I'm wrong but wouldn't the rules of simple algebra indicate that dividing both sides of the equation by D is in order here?

D(x) = Ax-2.e-Bx

(D(x))/D = (Ax-2.e-Bx)/D

x = (Ax-2.e-Bx )/D

Register to Reply
Anonymous Poster
#18
In reply to #16

Re: Rearranging a Function to Find X

12/24/2010 7:21 AM

Not too silly but the expression D(x) just means D is a function of x so the (x) bit could have been left out of the original eqn. like this

D = Ax-2.e-Bx

Also: unfortunately your final eqn. has Xs in the Right hand side as well as the Left.

Register to Reply Off Topic (Score 4)
Anonymous Poster
#20

Re: Rearranging a Function to Find X

12/26/2010 2:01 PM

This is a differential equation. I'm nowhere near my books, and it's been a little while, or I could give you a better answer, but there is no real simple solution to your problem. I can't remember which answer it is, but here are your two options:

1) Solutions of the form x = Asin(y) + Bcos(y)

2) This may be a transcendental equation. What that means is you can't actually solve it.

A linear approximation may be your shortest route to victory.

Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#21
In reply to #20

Re: Rearranging a Function to Find X

12/26/2010 4:42 PM

This is not a differential equation. Thankyou for your input.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply Off Topic (Score 5)
Power-User
Belgium - Member - New Member

Join Date: May 2007
Location: Flanders (Belgium)
Posts: 343
Good Answers: 21
#25

Re: Rearranging a Function to Find X

12/28/2010 9:52 AM

try this ones

y = A/x^2 - AB/x + 1/2 A B^2 -1/6 A B^3 x + 1/24 A B^4 x^2 - 1/120 A B^5 x^3

this is an approximation of the orginal function.

Register to Reply
Power-User
Belgium - Member - New Member

Join Date: May 2007
Location: Flanders (Belgium)
Posts: 343
Good Answers: 21
#33
In reply to #25

Re: Rearranging a Function to Find X

01/03/2011 12:59 PM

ex = Σ xn /n!

ex = 1 + x/1! + x2/2! + x3/3! + x4/4! + x5/5! + ….

e-Bx = 1 - Bx + B2x2/2 - B3x3/6 + B4x4/24 - B5x5/120 + ….

Ax-2 e-Bx = Ax-2 - ABx-1 + AB2/2 - AB3x/6 + AB4x2/24 - AB5x3/120 + ……

If you take A = 10 and B = 0.001 and x = 0.5 then increases the function with about minus 0.00000000083 if you take only the first five terms

In the region of x = 0.5, the increase of the function in maximal when x changes.

If this is still not accurate enough, you have to take more terms.

Register to Reply Score 1 for Good Answer
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#34
In reply to #33

Re: Rearranging a Function to Find X

01/03/2011 4:56 PM

Thanks, Rudy - now solve for x .

Seriously, your expansion is useful for plugging into the Newton-Raphson method for finding the solution by iteration.

Just taking the first term of your expansion, with f(x) = (Ax-2 e-Bx) - D,

f(x) ≈ Ax-2 - D,

f'(x) ≈ -2Ax-3

which is what I used in my solution in #28.

Including the second term would give me

f(x) ≈ Ax-2 -ABx-1 - D, and

f'(x) ≈ -2Ax-3 + ABx-2

I'll try it for completeness (?) - but I don't think it will make a practical difference. Thanks anyway.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Power-User
Belgium - Member - New Member

Join Date: May 2007
Location: Flanders (Belgium)
Posts: 343
Good Answers: 21
#35
In reply to #34

Re: Rearranging a Function to Find X

01/04/2011 6:28 AM

Hey john, thanks for the GA

What is the error, the fault tolerance you can accept ?

Which are the smallest values of D(x) and x you want to calculate ?

For x it is about 0.0001 according your post number 27, but what about D(x) ?

How accurate are the values of A and B ?

Rudy

Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#36
In reply to #35

Re: Rearranging a Function to Find X

01/04/2011 8:04 AM

Hi, Rudy,

As I've said in previous posts, the full equation is:

D(x) = Dc * (Xc/x)2 * e-μ(x-Xc),

where:

Dc is the decay-corrected "source term",
Xc is the calibration distance, and
μ is the air attenuation coefficient.

0.5000 <= x <= 5.0000, with x determined to the nearest 0.0001

Xc = 1.0000 (usually, though it may sometimes be 1.5000 or possibly 2.0000).

Dc can be anything from 1.000E0 to 1.000E-6 (it depends on the radiation source).

The range of D(x) is limited by the range of x values; with Xc = 1 and Dc normalized to 1 the range would be approximately D(0.5) = 4 to D(5) = 0.04. Note that Dc is just an abreviation of D(Xc).

Dc and μ are accurate to 4 significant figures.

The error in the answer should be as small as possible, but it is limited by the fact that x can only take the discrete values as noted above.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#28

Re: Rearranging a Function to Find X: A Working Solution

12/30/2010 8:30 AM

I've found something that works!

From my previous post #10, the full expression for doserate is:

D(x) = Dc * (Xc/x)2 * e-μ(x-Xc),

where:

Dc is the decay-corrected "source term",
Xc is the calibration distance, and
μ is the air attenuation coefficient.

On the basis that the exponential part changes very slowly compared with the power part, I thought I'd try a slightly "bent" version of the Newton-Raphson method.

Let f(x) = Dc*Xc2*x-2 * e-μ(x-Xc) - Dr,

where Dr is the required doserate.

A good approximation for the first derivative is then

f'(x) = -2Dc*Xc2*x-3

Plug this into the Newton-Raphson expression:

xn+1 = xn - f(xn)/f'(xn)

Using the inverse square law result as a first approximation for x, this converges to give a value of x yielding the required doserate within 0.01% after 4 iterations, even with |μ| as large as 0.1.

Many thanks to all for your invaluable input, which got me thinking hard enough and in the right direction to get there.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
Popular Science - Cosmology - New Member Engineering Fields - Civil Engineering - New Member Engineering Fields - Nuclear Engineering - New Member United States - Member - New Member

Join Date: Aug 2010
Posts: 714
Good Answers: 38
#29
In reply to #28

Re: Rearranging a Function to Find X: A Working Solution

12/30/2010 12:39 PM

I'm glad you found a solution. I love these types of problems and had a great time playing with it. I tried out Newton's method as well and probably should have communicated my findings (-1 point for me). I found Newton's slower or found a different solution outside the range you're interested in than the "quick and dirty" method (and hence I should have inquired more).

But that aside, good job and thanks for the brain exercise!

__________________
Sometimes my thoughts are in a degree of order so high even I don't get it...
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#30
In reply to #29

Re: Rearranging a Function to Find X: A Working Solution

12/30/2010 4:57 PM

I tried your solution (in #22) using Excel, and my attempt diverged violently! Think I must've misinterpreted something somewhere along the line. I'd be interested to see your method working - if you're OK with sending me an xls, please pm me and I'll give you my e-mail address. I'll understand if you're reluctant.

Thanks anyway for the prod in the right direction. I've found that for realistic values of the attenuation coefficient, my bodge converges sufficiently within 2 iterations, so I'm pretty happy with it. Provided I start with the (easily calculated) inverse square result as a first approximation, I haven't managed to find any "wrong" solutions.

Glad you had fun!

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Register to Reply 36 comments

Good Answers:

These comments received enough positive votes to make them "good answers".

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

Anonymous Poster (5); ChaoticIntellect (5); JohnDG (15); Lehman57 (1); Mikerho (1); rudy.leurs (3); Sciesis2 (1); Usbport (4); user-deleted-1105 (1)

Previous in Forum: Wireless Drivers Advent Modena M200 Blue   Next in Forum: Reply Email in iPhone 4

Advertisement