HP 15c Scientific manual Using in a Program

Page 192

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-7is 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.)

Image 192
Contents HP-15C Owner’s Handbook HP Part Number 00015-90001 Edition 2.4, SepLegal Notice Introduction Contents Contents Display and Continuous MemoryProgram Editing Program Branching and ControlsSubroutines Indirect Display Control Calculating With Complex NumbersCalculating With Matrices Numerical Integration Contents Appendix a Error Conditions Appendix C Memory AllocationAppendix D a Detailed Look at Appendix E a Detailed Look at fContents Appendix F Batteries Function Summary and IndexProgramming Summary and Index Subject IndexHP-15C Problem Solver Quick Look atManual Solutions To Compute Keystrokes DisplayProgrammed Solutions Keystrokes DisplayKeystrokesDisplay 001-42,21,11002 003 004 005 006 007 008 009 8313 300.51HP-15C a Problem Solver Part l HP-15C Fundamentals Power On and Off Getting StartedKeyboard Operation SectionPrefix Keys Changing SignsKeying in Exponents I O m ´ P I l F T s ? t H bClear Keys Display Clearing ` and − Digit entry not terminatedClears only the last digit Calculations One-Number FunctionsTwo-Number Functions 653217 + 26.0000 22.0000 500013.0000 78.0000Numeric Functions Number Alteration FunctionsOne-Number Functions General FunctionsTrigonometric Operations Time and Angle ConversionsPressing Calculates Degrees/Radians Conversions 7069Radians 40.5000Logarithmic Functions Hyperbolic FunctionsPower Function Two-Number FunctionsPercentages To Calculate Keystrokes DisplayPolar and Rectangular Coordinate Conversions Enters the base number the priceCalculates 3% of $15.76 the tax Polar Conversion. PressingKeystrokes Display Automatic Memory Stack Last X, and Data Storage Automatic Memory Stack Stack ManipulationAutomatic Memory Stack Registers Always displayedStack Manipulation Functions Memory Stack, Last X, and Data StorageLost Lost Last X Register and K 287.000022.2481 12.9000Calculator Functions and the Stack 13.9 +20.6475 Order of Entry and the v Key +15 X15Nested Calculations 7 +65.0000 69.0000Arithmetic Calculations With Constants 5 ‛15 Keys Keystrokes Display Growth factor 1000000 Storage Register Operations Storing and Recalling Numbers322.5000 520.8750Clearing Data Storage Registers Storage and Recall ArithmeticFor storage arithmetic For recall arithmeticProblems Overflow and Underflow24 l-0 15.0000Memory Stack, Last X, and Data Storage Statistics Functions Probability Calculations60.0000 Random Number Generator 270,725.00005764 3422Accumulating Statistics RegistersRegister Contents 20.00 40.00 60.00 80.00 Kg per hectare Metric tons per Hectare, y20 z 61v 40 z 7.21 60 z 7.78 80 z l Σy2Correcting Accumulated Statistics 20 w 20 zMean Standard Deviation40.00 Linear Regression 31.62Standard deviation about the mean nitrogen ApplicationLinear Estimation and Correlation Coefficient Statistics Functions Other Applications 70 ´jDisplay Continuous Memory Display ControlFixed Decimal Display Scientific Notation Display Engineering Notation Display234568 234567Round-Off Error Special DisplaysMantissa Display AnnunciatorsError Display Digit Separators12,345.67 12.345.6700Low-Power Indication Continuous MemoryStatus Resetting Continuous Memory Page Part ll HP-15C Programming Programming Basics MechanicsCreating a Program Loading a ProgramProgramming Basics ´b aIntermediate Program Stops Running a Program002 003 004 005 006 007 008 How to Enter Data 300.51 300.51 ´AProgram Memory Radius, r Height, h Base Area Volume Surface Area Totals002 004 005007-44,40 010Or G a Further Information Program InstructionsInstruction Coding Memory Configuration Keycode 25 second row, fifth keyInitial Memory Configuration 60 ´ m%Program Boundaries ´ m %19 ´ m% 19.0000Unexpected Program Stops Abbreviated Key Sequences´bA ´b3 End of memory User Mode Polynomial Expressions and Horners Method¤ @ y ∕ LOG %Nonprogrammable Functions 001-42,21,12002 003 004 005 006 007 008 009 0000 12,691.0000Problems Program Editing Moving to a Line in Program MemoryExamples Deleting Program LinesInserting Program Lines Or use  Single-Step Operations Line Position ÂholdRelease ResultInsertions and Deletions Initializing Calculator StatusInterest + i nPV 1 + i n 100 270 ´bA D ´4 O0 2* O1 2÷ * ´ ´ l0 l1 ´r * nProgram Branching Controls BranchingConditional Tests TestFlags  n will clear flag number nExample Branching and Looping 010-45,20 013-43,30014 016-44,40Example Flags Formula is002-43 004-42,21,15005-43, 4 006-42,21Go to 250.000048.0000 10,698.3049Looping Conditional BranchingSystem Flags Flags 8 Program Branching and Controls Subroutines Go To Subroutine and ReturnSubroutine Execution ´b.1Subroutine Limits 000 001- ´b9 002- R003- O0 004´ b.4 ´b.5Subroutine Return Nested SubroutinesIndex Register Loop Control V and % Keys106 Indirect Program Control With the Index Register Program Loop ControlIndex Register Storage and Recall Index Register and Loop ControlIndex Register Arithmetic Exchanging the X-RegisterIndirect Branching With Indirect Flag Control With Indirect Display Format Control WithLoop Control With Counters I and e Nnnnn x x x y y 5 0 0 Start count at zero Count by twos Count up toExamples Register Operations IterationsStoring and Recalling Keystrokes Display 12.3456Example Loop Control with e Exchanging the X-RegisterStorage Register Arithmetic Loop control number in R2 −− 011- 42012-42, 5 013- 22Example Display Format Control 15 O64.8420 0000 50.0000 Index Register Contents Indirect Display Control Index Register and Loop Control 118 Part lll HP-15C Advanced Functions Complex Stack and Complex Mode Calculating With Complex NumbersCreating the Complex Stack 120Deactivating Complex Mode Complex Numbers and the StackEntering Complex Numbers ´ % hold 8.0000 release Z 8 Y 7 X Keys Stack Lift in Complex Mode Manipulating the Real and Imaginary StacksClearing a Complex Number Or other operationContinue with any operation − 4 v Continue with any operationEntering Complex Numbers with −. The clearing functions − ´ %hold release0000 17.0000 144.0000 Entering a Real Number Followed by another numberEntering a Pure Imaginary Number ´ Continue with any operationOperations With Complex Numbers Storing and Recalling Complex Numbers´ O L 2 ´¤x N o ∕ @ a + * ÷ y2000 70000428 0491Polar and Rectangular Coordinate Conversions Complex Results from Real Numbers5708 ´ % hold Release1.5708Cos θ + i sin θ = re iθ Polar + ib = ∠ θ 8452 2981+ 3.1434 352.0000 872.00002361 4721For Further Information Calculating With Matrices 138Keystrokes Display Deactivates Complex Mode = A-1BMatrix Dimensions Running11.2887 2496Dimensioning a Matrix Number Rows ColumnsDisplaying Matrix Dimensions Changing Matrix Dimensions´mA Keystrokes l B DisplayStoring and Recalling Matrix Elements Storing and Recalling All Elements in Order⎡ a Checking and Changing Matrix Elements Individually Keystrokes Display Matrix Operations Storing a Number in All Elements of a MatrixMatrix Descriptors Result Matrix Copying a Matrix One-Matrix OperationsCalculating with Matrices Scalar Operations LB bElements of Result Matrix LA aArithmetic Operations Keystrokes Display Subtracts 1 from the elementsLB b 2 LA a 2 Matrix Multiplication = AT B Keystrokes Display l a aSolving the Equation AX = B 24 OA 240086 OA 8600274 OB 233 OB 331 OB 120.32 OB 112.96 OB 151.36 OB ´Á Calculating the Residual Week Cabbage kg 186 141 215 Broccoli kg 116Using Matrices in LU Form Calculations With Complex MatricesStoring the Elements of a Complex Matrix Then Z can be represented in the calculator byPressing Transforms Into = ⎢ LA aComplex Transformations Between ZP and Z Inverting a Complex Matrix Multiplying Complex Matrices ´ aKeystrokes lA lB Display Displays descriptor of matrix a ´U lC LC lC lC lC lC lC lC ´USolving the Complex Equation AX = B ZZ −1AX = B 200.0000 170.00000372 13110437 1543Calculating with Matrices Using a Matrix Element With Register Operations Using Matrix Descriptors in the Index RegisterMiscellaneous Operations Involving Matrices Stack Operation for Matrix Calculations Conditional Tests on Matrix DescriptorsCalculating with Matrices Using Matrix Operations in a Program Summary of Matrix Functions Keystrokes Results´m a Calculates residual in result matrix For Further Information Using Finding the Roots An Equation180 Finding the Roots of an Equation Clear program memory´b0 001-42,21002 003 005 006 007Finding the Roots of an Equation Desired rootKeystrokes ¥ ´ bA000 001-42,21,11 003 0045000 1 e t Brings another t-valueInto X-register 200 tWhen No Root Is Found 000 001-42,21 002 003 004 005Error Choosing Initial Estimates Label 003 004 005 007 X + 8008 009 6 x + 8Finding the Roots of an Equation Using in a Program Restriction on the Use Memory RequirementsUsing f Numerical Integration194 002 003 004 4040 1416 7652Begin subroutine with a label 3825 $ ÷4401 6054 Accuracy of f ´ i ´ f 8826 7091Using f in a Program 382Memory Requirements Error Conditions Error 0 Improper Mathematics OperationAppendix a 205Error 1 Improper Matrix Operation Error 2 Improper Statistics OperationError 3 Improper Register Number or Matrix Element Error 4 Improper Line Number or Label CallError 5 Subroutine Level Too Deep Error 6 Improper Flag NumberPr Error Power Error Stack Lift Last X Register Digit Entry TerminationStack Lift Appendix BDisabling Operations Enabling OperationsStack Stack Enabled. disabled 53.1301 No stack Lift Neutral OperationsAppendix B Stack Lift and the Last X Register Keys Nnn Clear u ¥Last X Register \ k + H ∆ \ h ÷ À P* q r c ‘ / N z ∕ P\ o jMemory Allocation Memory SpaceAppendix C RegistersAppendix C Memory Allocation Memory Reallocation Memory Status WM % Function Restrictions on Reallocation ´m% 1.0000 Whold 1 6419 ´ m Program Memory Automatic Program Memory ReallocationMemory Requirements for the Advanced Functions Two-Byte Program InstructionsIf executed TogetherAppendix C Memory Allocation Detailed Look at How WorksAppendix D 220Appendix D a Detailed Look at Accuracy of the Root X4 = 000 1718 006 007 008 009 010-43,30 011 012-43,30 013Interpreting Results ´ v B0681 − 45 For 0 x Test for x range Branch for x ≥3x 45x 2 + End subroutine000.0000 Initial estimates1358 Possible rootAppendix D a Detailed Look at ´ b.0 001-42,21,.0 002 003 004 005 Bring x-value into X-register007 008 009 010 013 014 015 016017 018 10 v ´ ‛ 20Error 0000 1250 5626 Finding Several RootsFx = xx a3 = 002 003 004 005 006 0076667 Same initial estimates Second rootStores root for deflation Deflated function valueDeflation for third root Limiting the Estimation Time For Advanced Information Counting IterationsSpecifying a Tolerance Detailed Look at f How f WorksAppendix E 240Accuracy, Uncertainty, and Calculation Time X = π1 0π cos4θ − x sinθ dθ0000 1416 ´ i ´ fKeystrokes Display Return approximation to ´ Clear u HoldKeystrokes ´ i Display ´ f ´ Clear u hold7858 7807Uncertainty and the Display Format Functions values for example Δx = 0.5×10−n ×10m = aδx dxb = ab 0.5×10−n + m x dx Conditions That Could Cause Incorrect Results ∞ xe− xdx 001-42,21 002- 1 003 004 005 Appendix E a Detailed Look at f Appendix E a Detailed Look at f Conditions That Prolong Calculation Time Keys lower limit into Keys upper limit intoApproximation to integral UncertaintyAppendix E a Detailed Look at f Obtaining the Current Approximation to an Integral For Advanced Information Low-Power Indication Installing New BatteriesBatteries BatteriesAppendix F Batteries Verifying Proper Operation Self-Tests 2.C 3.HFunction Summary and Index Complex FunctionsConversions Digit EntryDisplay Control Index Register ControlLogarithmic Exponential Functions Mantissa. PressingMathematics Matrix Functions146 Number Alteration To ZP page164To XT Percentage ProbabilityStack Manipulation Clear uStatistics StorageTrigonometry Programming Summary and Index 269Programming Summary and Index Subject Index 271Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Subject Index Product Regulatory Environment Information Federal Communications Commission NoticeModifications Canadian Notice Avis CanadienEuropean Union Regulatory Notice Body number is inserted between CE
Related manuals
Manual 63 pages 42.15 Kb