1. ## Practical problem

Hi, I hope you can help, it's a long time since school and I find my self with a practical problem where I need to isolate a variable in a formula. The formula is

S = ((DH/(H-D+F))-((DH/(H+D-F))

Is it possible to derive a formula or solve for D i.e isolate D given I have the values of all the other variables?
Many thanks for your help, this will help me a great deal
Steve

2. ## Re: Practical problem

Originally Posted by Stevekuk
Hi, I hope you can help, it's a long time since school and I find my self with a practical problem where I need to isolate a variable in a formula. The formula is

S = ((DH/(H-D+F))-((DH/(H+D-F))

Is it possible to derive a formula or solve for D i.e isolate D given I have the values of all the other variables?
Many thanks for your help, this will help me a great deal
Steve

First, I'll try to LaTex it up... then we'll see about an answer.

$\displaystyle S = \frac{DH}{H - D + F} - \frac{DH}{H + D - F}$

$\displaystyle S = \frac{DH(H + D - F) - DH(H - D + F)}{(H - D + F)(H + D - F)}$

$\displaystyle S = \frac{2DH(D - F)}{H^2 - (D - F)^2}$

Hmm...

3. ## Re: Practical problem

Originally Posted by Stevekuk
Hi, I hope you can help, it's a long time since school and I find my self with a practical problem where I need to isolate a variable in a formula. The formula is

S = ((DH/(H-D+F))-((DH/(H+D-F))

Is it possible to derive a formula or solve for D i.e isolate D given I have the values of all the other variables?
Many thanks for your help, this will help me a great deal
Steve
Get common denominators for your fraction by multiplying numerator and denominator of the first fraction by H+ D- F and multiplying the numerator and denominator of the second fraction by H- D+ F:
$\displaystyle S= \frac{DH(H+ D- F)}{(H-D+ F)(H+D-F)}- \frac{DH(H-D+ F)}{(H- D+ F)(H+ D- F)}$
$\displaystyle S= \frac{DH^2+ D^2H- DFH- DH^2+ D^2F- DFH}{(H+ D- F)(H- D+ F)}= \frac{2D^2H- DFH}{(H+ D- F)(H- D+ F)}$

Multiply both sides by (D+ H- F)(D- H+ F) to get rid of the fraction
$\displaystyle S(D+ H- F)(D- H-+ F)= 2D^2H- DFH$

Note that D- H+ F= D- (H+ F) so that (D+ H- F)(D- H+ F) is a :"product of sum and difference"- $\displaystyle (D+ (H-F))(D- (H- F))= D^2- (H- F)^2$ so we have
$\displaystyle S(D^2- (H- F)^2)= SD^2- DFH$
$\displaystyle SD^2- S(H- F)^2= 2D^2- DFH$
Subtract $\displaystyle 2D^2- DFH$ from both sides to get
$\displaystyle SD^2- 2D^2- S(H-F)+ DFH= (S- 2)D^2+ (FH)D- S(H-F)= 0$

That's a quadratic equation and you can solve for D using the quadratic formula:
"If $\displaystyle ax^2+ bx+ c= 0$ then $\displaystyle x= (-b\pm\sqrt{b^2- 4ac})/(2a)$
with $\displaystyle a= S- 2$, $\displaystyle b= FH$, and $\displaystyle c= -S(H- F)$.
$\displaystyle x= \frac{-FH\pm\sqrt{F^2H^2- 4(S-2)(-S(H-F)}}{2(S- 2)}$

(If S= 2, you cannot use that formula because you cannot divide by 0, then this is not a quadratic at all but is FHD- 2(H- F)= 0 which has solution
$\displaystyle D= 2(H- F)/FH= \frac{2}{F}- \frac{2}{H}$.)

4. ## Re: Practical problem

Sorry I didn't know how to format it properly but your first line is a true reflection of the sart formula. Is it possible to isolate D from here?
Many thanks
Steve

5. ## Re: Practical problem

Wow, thanks, your reply came through as I was typing my reply to the first. I'll just digest this

6. ## Re: Practical problem

I have corrected my many formatting errors!

7. ## Re: Practical problem

Sorry but I'm clueless when it comes to this which is why I'm glad you're around. Are you saying that

D = 2/F - 2/H

I was expecting to see S still there?

8. ## Re: Practical problem

To explain what I'm trying to do: I'm trying to manipulate the formula used in photography to calculate the depth of field (DoF) within a photograph i.e the amount of image in acceptable focus. This is dependent on a few things, your camera's sensor, the focal length and aperature of your lens and the distance you are from the subject. It is a common formula that it used widely but I have only ever seen it to calculate the DoF which I have called S. I was trying to solve it for the distance required D, so I can work out exactly how far away I need to be for a certain amount of the image to be in focus without the trial and error involved using the more traditional formula. So, after a bit of basic formula engineering I got it to the point within my original post but got stuck trying to solve it for S (Sharp focus). F is the focal length of the lens and H is the hyperfocal point - the distance that maximises the DoF. So hopefully you can see this is a practical problem that would help me out greatly.

As a practical example to work backwards to get D, i use

D = 1000
F = 50
H = 44759.2311
Which gives S = 42.468478, this is in millimetres so 4.246 cm should be in focus if my subject is 100cm away using a 50mm lens. But say I know that I want about 4cm to be in focus so what distance do I need to be at? hence solving it for D? Plugging the other known values back into the solved formula I hope to get D = 1000 but it doesn't seem to be there just yet?

Once again many thanks for your help
Steve

9. ## Re: Practical problem

Originally Posted by Stevekuk
Sorry but I'm clueless when it comes to this which is why I'm glad you're around. Are you saying that

D = 2/F - 2/H

I was expecting to see S still there?
That was "If S= -2".

10. ## Re: Practical problem

Thank you for clarifying, as S is a distance it will always be positive so is what I'm trying to achieve possible? I haven't got the maths knowledge to solve it myself so I understand if it's not possible
Many thanks
Steve

11. ## Re: Practical problem

Note that D- H+ F= D- (H+ F) so that (D+ H- F)(D- H+ F) is a :"product of sum and difference"-
Did you trip up here HallsofIvy?

The original was (h-d+f)(h+d-f)

$\displaystyle h-d+f=h-(d-f)$
$\displaystyle h+d-f=h+(d-f)$

From there I have...

$\displaystyle s=\dfrac{((dh(h+d-f) )-(dh(h-d+f) ))}{(h-(d-f))(h+(d-f))}\ \ =\ \ \dfrac{dh(2d-2f)}{(h-(d-f))(h+(d-f))}$

This reduces down to

$\displaystyle (2h+s)d^2-2f(h+s)d+(fs^2-2h^2 )=0$

and the best I could get for d was

$\displaystyle d=\dfrac{f(h+s)\pm\sqrt{f^2(h+s)^2-fs^2+2h^2}}{2h+s}$

12. ## Re: Practical problem

Huge thank you for this. Just to prove how clueless I am with this, if I substitute the values in and solve for d using + and - I get 2 values as is the nature of the formula I suppose. The aim is to get one formula for d that will give a single answer, is this possible?
Thanks again
Steve

13. ## Re: Practical problem

Not really since the square root part is positive

$\displaystyle f^2 (h+s)^2-fs^2+2h^2=[f^2(h+s)^2+2h^2]-fs^2$

if the square root of this is less than $\displaystyle f(h+s)$
then there are 2 solutions

if it is greater than $\displaystyle f(h+s)$ then you can disregard the -ve root

hope this helps

btw, I know nothing about photography. If any of your other variables can have a negative value, let me know which

Pro

14. ## Re: Practical problem

None of the original variables will be negative. Using the values I gave as an example, the square is more than f(h+s) so ignoring the minus then I make d=50.03369 which is spookly close to f but I was expecting d to equal 1000?

Thanks again
Steve

15. ## Re: Practical problem

The values you gave in your example actually give S as

$\displaystyle S=42.468476$

not the 42.468478 you said

That could be where you're getting the slight deviation

Pro

Page 1 of 2 12 Last