Difference between revisions of "Example:compound nomograph 2"

From Pynomo
Jump to: navigation, search
(Simple example)
(Source code of simple compound nomograph example)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Compound nomograph example 2 ==
 
== Compound nomograph example 2 ==
In this example we construct compound nomograph of equation
+
In this example we construct compound nomograph for solving equation
  
 
<math>q = u^v + w. \,</math>
 
<math>q = u^v + w. \,</math>
  
This example is taken from [Epstein: Nomography, p. 66]. The equation is split into two equations that each are blocks:
+
This example is taken from <ref>Epstein: Nomography, p. 66</ref>. The equation is split into two equations that each are blocks:
  
 
{| style="background:wihte; color:black" border="1" cellpadding="5" cellspacing="0"  
 
{| style="background:wihte; color:black" border="1" cellpadding="5" cellspacing="0"  
Line 14: Line 14:
  
 
Because one equation has r and other log(r), we need to use ladders, that are [[type 6]]. Ladders are
 
Because one equation has r and other log(r), we need to use ladders, that are [[type 6]]. Ladders are
ugly and we use them because there is no other choice (if we forget "contour" = [[type 5]].)
+
not generally elegant choice and we use them because there is no other choice (if we forget "contour" = [[type 5]].)
 +
<references />
  
 
== Simple example ==
 
== Simple example ==
Line 29: Line 30:
 
     Compound nomograph: q = u**v+w
 
     Compound nomograph: q = u**v+w
  
     Copyright (C) 2007-2008 Leif Roschier
+
     Copyright (C) 2007-2009 Leif Roschier
  
 
     This program is free software: you can redistribute it and/or modify
 
     This program is free software: you can redistribute it and/or modify
Line 44: Line 45:
 
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
"""
from nomographer import *
+
from pynomo.nomographer import *
  
 
# N
 
# N
Line 52: Line 53:
 
         'function':lambda u:log(u),
 
         'function':lambda u:log(u),
 
         'title':r'$u$',
 
         'title':r'$u$',
         'tick_levels':3,
+
         'tick_levels':4,
         'tick_text_levels':1,
+
         'tick_text_levels':3,
 
         'tick_side':'left',
 
         'tick_side':'left',
 +
        'scale_type':'linear smart',
 
                 }
 
                 }
  
Line 99: Line 101:
 
             'f2_params':v_params,
 
             'f2_params':v_params,
 
             'f3_params':R_params,
 
             'f3_params':R_params,
 +
            'isopleth_values':[[6,0.5,'x']]
 
             }
 
             }
 
# Ladder
 
# Ladder
Line 129: Line 132:
 
               'height':10.0,
 
               'height':10.0,
 
               'mirror_x':True,
 
               'mirror_x':True,
 +
              'isopleth_values':[['x','x']]
 
                     }
 
                     }
 
# type 1: q-w-r=0
 
# type 1: q-w-r=0
Line 146: Line 150:
 
         'function':lambda u:-u,
 
         'function':lambda u:-u,
 
         'title':r'$w$',
 
         'title':r'$w$',
         'tick_levels':2,
+
         'tick_levels':3,
 
         'tick_text_levels':1,
 
         'tick_text_levels':1,
 
                 }
 
                 }
Line 155: Line 159:
 
         'function':lambda u:u,
 
         'function':lambda u:u,
 
         'title':r'$q$',
 
         'title':r'$q$',
         'tick_levels':2,
+
         'tick_levels':3,
 
         'tick_text_levels':1,
 
         'tick_text_levels':1,
 
                 }
 
                 }
Line 167: Line 171:
 
             'f2_params':w_params,
 
             'f2_params':w_params,
 
             'f3_params':q_params,
 
             'f3_params':q_params,
             'mirror_x':False
+
             'mirror_x':False,
 +
            'isopleth_values':[['x',3,'x']]
 
             }
 
             }
  
Line 178: Line 183:
 
               }
 
               }
 
Nomographer(main_params)
 
Nomographer(main_params)
 +
 +
  
  
  
 
</source>
 
</source>

Latest revision as of 19:17, 21 October 2009

Compound nomograph example 2

In this example we construct compound nomograph for solving equation

[math]q = u^v + w. \,[/math]

This example is taken from [1]. The equation is split into two equations that each are blocks:

[math]\log (r) = v \log (u) \,\,\,\,\,\,\,[/math] type 2
[math]q-w-r=0 \,\,\,\,\,\,\,[/math] type 1

Because one equation has r and other log(r), we need to use ladders, that are type 6. Ladders are not generally elegant choice and we use them because there is no other choice (if we forget "contour" = type 5.)

  1. Epstein: Nomography, p. 66

Simple example

Compound nomograph: example 2
Ex compound nomo 2.png
Generated portable document file (pdf): File:Ex compound nomo 2.pdf

Source code of simple compound nomograph example

"""
    ex_compound_nomo_2.py
 
    Compound nomograph: q = u**v+w
 
    Copyright (C) 2007-2009  Leif Roschier
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
from pynomo.nomographer import *
 
# N
u_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:log(u),
        'title':r'$u$',
        'tick_levels':4,
        'tick_text_levels':3,
        'tick_side':'left',
        'scale_type':'linear smart',
                }
 
v_params={
        'u_min':0.1,
        'u_max':20.0,
        'function':lambda v:1.0/v,
        'title':r'$v$',
        'scale_type':'log',
        'tick_levels':0,
        'tick_text_levels':0,
        'extra_params':[{
                'u_min':0.1,
                'u_max':0.9,
                'tick_levels':3,
                'tick_text_levels':2,
                'tick_side':'left'
                },
                {
                'u_min':1.0,
                'u_max':20.0,
                'tick_levels':4,
                'tick_text_levels':2,
                'tick_side':'right'
                }
                ]
                }
 
R_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda r:log(r),
        'title':r'',
        'tick_levels':0,
        'tick_text_levels':0,
        'tag':'ra',
                }
 
block_params_1={
             'block_type':'type_2',
             'width':10.0,
             'height':10.0,
             'f1_params':u_params,
             'f2_params':v_params,
             'f3_params':R_params,
             'isopleth_values':[[6,0.5,'x']]
             }
# Ladder
R_params_a={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:log(u),
        'title':'r',
        'tick_levels':3,
        'tick_text_levels':2,
        'tick_side':'left',
        'tag':'ra',
        }
 
R_params_b={
        'u_min':0.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':'r',
        'tick_levels':3,
        'tick_text_levels':2,
        'tag':'rb'
        }
 
block_params_2={
              'block_type':'type_6',
              'f1_params':R_params_a,
              'f2_params':R_params_b,
              'width':5.0,
              'height':10.0,
              'mirror_x':True,
              'isopleth_values':[['x','x']]
                     }
# type 1: q-w-r=0
r_params_c={
        'u_min':0.0,
        'u_max':10.0,
        'function':lambda u:-u,
        'title':r'$r$',
        'tick_levels':2,
        'tick_text_levels':1,
        'tag':'rb'
                }
 
w_params={
        'u_min':-10.0,
        'u_max':10.0,
        'function':lambda u:-u,
        'title':r'$w$',
        'tick_levels':3,
        'tick_text_levels':1,
                }
 
q_params={
        'u_min':0.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':r'$q$',
        'tick_levels':3,
        'tick_text_levels':1,
                }
 
 
block_params_3={
             'block_type':'type_1',
             'width':10.0,
             'height':10.0,
             'f1_params':r_params_c,
             'f2_params':w_params,
             'f3_params':q_params,
             'mirror_x':False,
             'isopleth_values':[['x',3,'x']]
             }
 
main_params={
              'filename':'ex_compound_nomo_2.pdf',
              'paper_height':13.0,
              'paper_width':20.0,
              'block_params':[block_params_1,block_params_2,block_params_3],
              'transformations':[('rotate',0.01),('scale paper',)],
              }
Nomographer(main_params)