Home > HP > Calculator > HP 15c Manual

HP 15c Manual

    Download as PDF Print this page Share this page

    Have a look at the manual HP 15c Manual online for free. It’s possible to download the document as PDF or print. UserManuals.tech offer 1114 HP manuals and user’s guides for free. Share the user manual or guide on Facebook, Twitter or Google+.

    							 Section 13: Finding the Roots of an Equation 191 
     
    By  making  the  height  1.5  decimeters,  a 
    5.0×1.0×1.5-decimeter box is specified. 
    If  you  ignore  the  upper  limit  on  the 
    height  and  use  initial  estimates  of  3  and 
    4  decimeters  (still  less  than  the  width), 
    you  will  obtain  a  height  of  4.2026 
    decimeters – a  root  that  is  physically 
    meaningless.  If  you  use  small  initial 
    estimates  such  as  0  and  1 decimeter, 
    you  will  obtain  a  height  of 0.2974 
    decimeter – producing  an  undesirably 
    short, flat box. 
    As an aid for examining the behavior of a  function, you can easily evaluate 
    the  function  at  one  or  more  values  of x using  your  subroutine  in  program 
    memory. To do this, fill the stack with x. Execute the subroutine to calculate 
    the value of the function (press ´ letter label or G label. 
    The values you calculate can be plotted to give  you a graph of the function. 
    This  procedure  is  particularly  useful  for  a  function  whose  behavior  you  do 
    not  know.  A  simple-looking  function  may  have  a  graph  with  relatively 
    extreme  variations  that  you  might  not  anticipate.  A  root  that  occurs  near  a 
    localized  variation  may  be  hard  to  find  unless you  specify  initial  estimates 
    that are close to the root. 
    If you have no informed or intuitive concept of the nature of the function or 
    the location of the zero you are seeking, you can search for a solution using 
    trial-and-error. The success of finding a solution depends partially upon the 
    function itself. Trial-and-error is often – but not always – successful. 
     If you specify two moderately large positive or negative estimates and 
    the functions graph does not have a horizontal asymptote, the routine 
    will seek a zero which might be the  most positive or negative (unless 
    the function oscillates many times, as the trigonometric functions do). 
     If  you  have  already  found  a  zero  of  the  function,  you  can  check  for 
    another  solution  by  specifying  estimates  that are  relatively  distant 
    from any known zeros. 
    Graph of f(x)   
    						
    							192 Section 13: Finding the Roots of an Equation 
     
     
     Many  functions  exhibit  special  behavior  when  their  arguments 
    approach zero. You can check your function to determine values of x 
    for which any argument within your function becomes zero, and then 
    specify estimates at or near those values. 
    Although  two  different  initial  estimates  are  usually  supplied  when  using 
    _, you can also use _ with the same estimate in both the X- and 
    Y-registers. If the two estimates are identical, a second estimate is generated 
    internally.  If  your  single  estimate  is  nonzero,  the  second  estimate  differs 
    from  your  estimate  by  one  count  in  the  seventh  significant  digit.  If  your 
    estimate is zero, 1×10-7 is used as the second estimate. Then the root-finding 
    procedure continues as it normally would with two estimates. 
    Using _ in a Program 
    You  can  use  the _ operation  as  part  of  a  program.  Be  sure  that  the 
    program provides initial estimates in the X- and Y-registers just prior to the 
    _ operation.  The _ routine  stops  with  a  value  of x in  the 
    X-register  and  the  corresponding  function  value  in  the  Z-register.  If  the x-
    value  is a root, the program proceeds to the next line. If the x-value is not a 
    root, the next line is skipped. (Refer also to Interpreting Results on page 226 
    for  a  further  explanation  of  roots.)  Essentially,  the _ instruction  tests 
    whether  the x-value  is  a  root  and  then  proceeds  according  to  the  ―Do  if 
    True‖ rule. The program can then handle the case of not finding a root, such 
    as by choosing new initial estimates or changing a function parameter. 
    The  use  of _ as  an  instruction  in  a  program  utilizes  one  of  the  seven 
    pending  returns  in  the  calculator.  Since  the  subroutine  called  by _ 
    utilizes  another  return,  there  can  be  only  five  other  pending  returns. 
    Executed  from  the  keyboard,  on the  other  hand, _ itself  does  not 
    utilize  one  of  the  pending  returns,  so  that  six  pending  returns  are  available 
    for  subroutines  within  the  subroutine  called  by _.  Remember  that  if 
    all  seven  pending  returns  have  been  utilized,  a  call  to  another  subroutine 
    will result in a display of Error 5. (Refer to page 105.)  
    						
    							 Section 13: Finding the Roots of an Equation 193 
     
    Restriction on the Use of _ 
    The  one  restriction  regarding  the  use  of _ is  that _ cannot  be 
    used  recursively.  That  is,  you  cannot  use _ in  a  subroutine  that  is 
    called  during  the  execution  of _.  If  this  situation  occurs,  execution 
    stops  and Error 7 is  displayed.  It is possible,  however,  to  use _ with 
    f thereby using the advanced capabilities of both of these keys. 
    Memory Requirements 
    _ requires  five  registers  to  operate.  (Appendix  C  explains  how  they 
    are  automatically  allocated  from  memory.)  If  five  unoccupied  registers  are 
    not available, _ will not run and Error 10 will be displayed. 
    A routine that combines _ and f requires 23 registers of space. 
    For Further Information 
    In  appendix  D,  Advanced  Use  of _,  additional  techniques  and 
    explanations for using _ are presented. These include: 
     How _ works. 
     Accuracy of the root. 
     Interpreting results. 
     Finding several roots. 
     Limiting estimation time. 
       
    						
    							 
    194 
    Section 14 
    Numerical Integration 
    Many  problems  in  mathematics,  science,  and 
    engineering  require  calculating  the  definite 
    integral  of  a  function.  If  the  function  is 
    denoted  by f(x) and  the  interval  of  integration 
    is a to b, the  integral  can  be  expressed 
    mathematically as 
     
    The  quantity I can  be  interpreted 
    geometrically  as  the  area  of  a  region  bounded  by  the  graph  of f(x), the 
    x-axis, and the limits x = a and x = b.* 
    When  an  integral  is  difficult  or  impossible  to  evaluate  by  analytical 
    methods,  it  can  be  calculated  using  numerical  techniques.  Usually,  this  can 
    be  done  only  with  a  fairly  complicated  computer  program.  With  your 
    HP-15C,  however,  you  can  easily  do  numerical  integration  using  the f 
    (integrate) key.†=
    Using f 
    The basic rules for using f are: 
    1. In Program mode, key in a subroutine that evaluates the function f(x) that 
    you  want  to  integrate.  This  subroutine  must  begin  with  a  label 
    instruction  (´b label)  and  end  up  with  a  value  for f(x) in  the  X-
    register. 
                                                               * Provided that f(x) is nonnegative throughout the interval of integration. †=The f function  does  not  use  the  imaginary  stack.  Refer  to  the HP-15C Advanced  Functions  Handbook for information about using f in Complex mode. .)(dxxfIba   
    						
    							 Section 14: Numerical Integration 195 
     
     
     In Run mode: 
    2. Key  the  lower  limit  of  integration  (a)  into  the  X-register,  then  press 
    v to lift it into the Y-register. 
    3. Key the upper limit of integration (b) in to the X-register. 
    4. Press ´ f followed by the label of your subroutine. 
    Example: Certain  problems  in  physics  and  engineering  require  calculating 
    Bessel  functions. The  Bessel  function  of  the  first  kind  of  order  0  can  be 
    expressed as 
    . 
    Find 
    . 
    In Program mode, key in the following subroutine to evaluate the function 
    f(θ) = cos (sin θ). 
    Keystrokes Display  
    |¥ 000– Program mode. 
    ´ CLEAR M 000– Clear program memory. 
    ´b 0 001–42,21, 0 Begin subroutine with a 
    b instruction. 
    Subroutine assumes a 
    value of θ is in X-register. 
    [ 002–      23 Calculate sin θ. 
    \ 003–      24 Calculate cos (sin θ). 
    |n 004–   43 32  
    Now, in Run mode key the lower limit of integration into the Y-register and 
    the  upper  limit  into  the  X-register.  For  this  particular  problem,  you  also 
    need to specify Radians mode for the trigonometric functions. 
     π
    00  )sin  ( cos π
    1)(dθθxxJ π
    00  )(sin  cos π
    1(1)dθθJ  
    						
    							196 Section 14: Numerical Integration 
     
    Keystrokes Display  
    | ¥  Run mode. 
    0 v 0.0000 Key lower limit, 0, into Y-
    register. 
    | $ 3.1416 Key upper limit, π, into X-
    register. 
    |R 3.1416 Specify Radians mode for 
    trigonometric functions. 
    Now  you  are  ready  to  press ´f 0 to  calculate  the  integral.  When  you 
    do so, youll find that – just as with _ – the calculator will not display 
    the  result  right  away,  as  it  does  with  other  operations.  The  HP-15C 
    calculates  integrals  using  a  sophisticated  iterative  algorithm.  Briefly,  this 
    algorithm  evaluates f(x), the  function  to  be integrated,  at  many  values  of x 
    between  the  limits  of  integration.  At  each  of  these  values,  the  calculator 
    evaluates  the  function  by  executing  the  subroutine  you  write  for  that 
    purpose.  When  the  calculator  must  execute  the  subroutine  many  times – as 
    it does when you press f – you cant expect any answer right away. Most 
    integrals  will  require  on  the  order  of 2  to  10  seconds;  but  some  integrals 
    will  require  even  more.  Later  on  well  discuss  how  you  can  decrease  the 
    time  somewhat;  but  for  now  press ´f 0  and  take  a  break  (or  read 
    ahead) while the HP-15C takes care of the drudgery for you. 
    Keystrokes Display  
    ´f 0 2.4040 . 
    In  general,  dont  forget  to  multiply  the  value  of  the  integral  by  whatever 
    constants,  if  any,  are  outside  the  integral.  In  this  particular  problem,  we 
    need to multiply the integral by 1/ π to get J0 (1): 
    Keystrokes Display  
    |$ 3.1416  
    ÷ 0.7652 J0 (1). π0dθ θ)(sin  cos   
    						
    							 Section 14: Numerical Integration 197 
     
    Before  calling  the  subroutine  you  provide  to  evaluate f(x), the f 
    algorithm – just like the _ algorithm – places the value of x in the X-, 
    Y-,  Z-,  and  T-registers.  Because  every  stack  register  contains  the x-value, 
    your  subroutine  can  calculate  with  this  number  without  having  to  recall  it 
    from  a  storage  register.  The  subroutines  in  the  next  two  examples  take 
    advantage  of this  feature. (A  polynomial evaluation technique  that assumes 
    the stack is filled with the value of x is discussed on page 79.) 
    Note: Since  the  calculator  puts  the  value  of x into  all  stack 
    registers,  any  numbers  previously  there  will  be  replaced  by x. 
    Therefore,  if  the  stack  contains  intermediate  results  that youll 
    need  after  you  calculate  an  integral,  store  those numbers  in 
    storage registers and recall them later. 
    Occasionally  you  may  want  to  use  the  subroutine  that  you wrote 
    for  the f operation  to  merely  evaluate  the  function  at  some 
    value  of x. If  you  do  so  with  a  function  that  gets x from the  stack 
    more  than  once,  be  sure  to  fill  the  stack  manually with  the  value 
    of x, by  pressing vvv, before  you  execute  the 
    subroutine. 
    Example: The  Bessel  function of the  first kind of order 1 can be  expressed 
    as 
     
    Find  
     
    Key  in  the  following  subroutine  that  evaluates  the  function  
    f(θ) = cos (θ - sin θ). 
    Keystrokes Display  
    | ¥ 000-  Program mode. 
    ´ b 1 001-42,21,  1 Begin subroutine with a label.  .  )sin   - (  cos  π
    1)(π
    01dθθxxJ .  )sin   - (  cos  π
    1)(π
    01dθθ1J  
    						
    							198 Section 14: Numerical Integration 
     
     
    Keystrokes Display  
    [ 002– 23 Calculate sin θ. 
    - 003– 30 Since a value of θ will be 
    placed into the Y-register by 
    the f algorithm before it 
    executes this subroutine, the 
    - operation at this point 
    will calculate  
    (θ – sin θ). 
    \  004–  24 Calculate cos (θ – sin θ). 
    |n 005–  43 32  
    In  Run  mode,  key  the  limits  of  integration  into  the  X- and  Y-registers.  Be 
    sure  that  the  trigonometric  mode  is set  to  Radians, then press ´f 1 to 
    calculate  the  integral.  Finally,  multiply  the  integral  by  1/π  to  calculate 
    J1 (1). 
    Keystrokes Display  
    |¥  Run mode. 
    0 v 0.0000 Key lower limit into  
    Y-register. 
    | $ 3.1416 Key upper limit into  
    X-register. 
    | R 3.1416 (If not already in 
    Radians mode.) 
    ´f 1 1.3825 
     
    |$ ÷ 0.4401 J1 (1).  
    Example: Certain  problems  in 
    communications  theory  (for  example,  pulse 
    transmission  through  idealized  networks) 
    require  calculating  an  integral  (sometimes 
    called the sine integral) of the form 
    . tdxx
    xtSi0
    )sin()(   
    						
    							 Section 14: Numerical Integration 199 
     
    Find Si(2). 
    Key in the following subroutine to evaluate the function f(x) = (sin x) / x.* 
    Keystrokes Display  
    |¥ 000– Program mode. 
    ´ b .2 001–42,21, .2 Begin subroutine with a b 
    instruction. 
    [ 002– 23 Calculate sin x. 
    ® 003– 34 Since a value of x will be 
    placed in the Y-register by the 
    f algorithm before it 
    executes this subroutine, the 
    ® operation at this point 
    will return x to the X-register 
    and move sin x to the Y-
    register. 
    ÷ 004– 10 Divide sin x by x. 
    | n 005–    43 32  
    Now key the limits of integration into the X- and Y-registers. In Radians 
    mode, press ´f .2 to calculate the integral. 
    Keystrokes Display  
    |¥ 0.4401 Run mode. 
    0 v 0.0000 Key lower limit into Y-
    register. 
    2 2 Key upper limit, into X-
    register. 
    | R 2.0000 (If not already in Radians 
    mode.) 
    ´f .2 1.6054 Si(2). 
                                                               * If  the  calculator  attempted  to  evaluate f(x) =  (sin x)/x at x =  0,  the  lower  limit  of  integration,  it  would terminate with Error 0 in the display  (signifying an attempt to divide by zero), and the  integral could  not be  calculated.  However,  the f algorithm  normally  does not evaluate  functions  at  either  limit  of integration, so the calculator can calculate the integral of a function that is undefined there. Only when the endpoints  of  the  interval  of  integration  are  extremely  close  together,  or  the  number  of  sample  points  is extremely large, does the algorithm evaluate the function at the limits of integration.  
    						
    							200 Section 14: Numerical Integration 
     
    Accuracy of f 
    The accuracy of the integral of any function depends on the accuracy of the 
    function  itself.  Therefore,  the  accuracy  of  an  integral  calculated  using f 
    is limited by the accuracy of the function calculated by your subroutine.* To 
    specify  the  accuracy  of  the  function,  set  the  display  format  so  that  the 
    display shows no more than the number of digits that  you consider accurate 
    in  the  functions  values.†=If= you  specify  fewer  digits,  the  calculator= will=
    compute  the  integral= more= quickly;‡=but  it= will= presume  that= the  function= is=
    accurate= to= only= the  number= of=digits= specified  in= the  display  format.  Well 
    show= you  how  you  can  determine  the  accuracy= of= the  calculated= integral=
    after we say another word about the display formatK=
    Youll= recall= that= the  HPJ15C  provides= three  types  of= display  formatting:=
    •, i, and ^. Which display format  should be used is largely a 
    matter  of  convenience,  since  for  many  integrals  youll  get  about  the  same 
    results  using  any  of  them  (provided  that  the  number  of  digits  is  specified 
    correctly,  considering  the  magnitude  of  the  function).  Because  its  more 
    convenient  to  use i display  format  when  calculating  most  integrals, 
    well use i when calculating integrals in subsequent examples. 
    Note: Remember  that  once  you  have  set  the  display  format,  you 
    can change the number of digits appearing in the display by storing 
    a  number  in  the  Index  register  and  then  pressing ´ • V, 
    ´ i V, or ´ ^ V, as  described  in  section  10. 
    This  capability  is  especially  useful  when f is  executed  as  part 
    of a program. 
                                                               * It  is  possible  that  integrals  of  functions  with  certain  characteristics  (such  as  spikes  or  very  rapid oscillations) might be  calculated  inaccurately.  However, this  possibility  is  very  small.  The  general characteristics  of  functions  that  could  cause  problems,  as  well  as  techniques  for  dealing  with  them,  are discussed in appendix E. † The  accuracy  of  a  calculated  function  depends  on  such  considerations  as  the  accuracy  of  empirical constants  in  the  function as well as round–off error  in the calculations. These considerations are discussed in more detail in the HP-15C Advanced Functions Handbook. ‡ The reason for this is discussed in appendix E.  
    						
    All HP manuals Comments (0)