Jump to content

Maple/Depth of field for optical lens

From Wikibooks, open books for an open world
DOF calculation diagram

> restart; > NULL; > > e1 := (vn-v)/vn = c/d:

> e2 := (v-vf)/vf = c/d:

> e3 := N = f/d:

> e4 := 1/Dn+1/vn = 1/f:

> e5 := 1/Df+1/vf = 1/f:

> e6 := 1/s+1/v = 1/f:

> sys := {e1, e2, e3, e4, e5, e6}; #Set of 6 equations

>var := {Df, Dn, d, v, vf, vn}; #6 variables

>sol := solve(sys,var); #solve the equation set

Find hyperfocal distance


> tm3 := 1/op(op(sol)[1])[2] = 0;

> tm4 := H = solve(tm3, s);

                           f (f + c N)
                       H = -----------
                               c N    

> > eqf := {tm4, op(sol)[1], op(sol)[2]};

varf := {Df, Dn, c};

    /               2                          2          
    |            s f                        s f           
   < Df = ------------------, Dn = - -------------------, 
    |      2                           2                  
    \     f  + c N f - c N s         -f  + c N f - c N s  
                    \ 
         f (f + c N)| 
     H = ----------- >
             c N    | 
                    / 
                         {Df, Dn, c}
 eqf:=  {,,};



> solve(eqf, varf);

      /                                          2    \ 
      |     s (H - f)        s (H - f)          f     | 
     < Df = ---------, Dn = -----------, c = --------- >
      |       H - s         H - 2 f + s      N (H - f)| 
      \                                               / 

>