Web-Books
im Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Seite - 207 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

Seite - 207 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Bild der Seite - 207 -

Bild der Seite - 207 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Text der Seite - 207 -

6.7 Exercises 207 Exercise6.2: See if the secantmethod fails Does the secant method behave better thanNewton’smethod in the problem de- scribed inExercise6.1?Try the initial guesses 1. x0 D1:08andx1 D1:09 2. x0 D1:09andx1 D1:1 3. x0 D1andx1 D2:3 4. x0 D1andx1 D2:4 Filename:secant_failure.*. Exercise6.3:Understandwhythebisectionmethodcannot fail Solve the sameproblemas inExercise 6.1, using the bisectionmethod, but let the initial interval be Œ 5;3 . Report how the interval containing the solution evolves during the iterations. Filename:bisection_nonfailure.*. Exercise6.4:Combine thebisectionmethodwithNewton’smethod An attractive idea is to combine the reliability of the bisection method with the speed of Newton’s method. Such a combination is implemented by running the bisection method until we have a narrow interval, and then switch to Newton’s methodfor speed. Write a function that implements this idea. Start with an interval Œa;b and switch to Newton’s method when the current interval in the bisection method is a fraction s of the initial interval (i.e., when the interval has length s.b a/). Po- tential divergenceofNewton’smethod is still an issue, so if the approximate root jumps out of the narrowed interval (where the solution is known to lie), one can switch back to thebisectionmethod. Thevalueof smust begivenas an argument to the function,but itmayhaveadefault valueof0.1. Try thenewmethodon tanh.x/D0with an initial interval Œ 10;15 . Filename:bisection_Newton.py. Exercise6.5:Writea test function forNewton’smethod Thepurposeof this functionis toverify the implementationofNewton’smethod in theNewton function in the filenonlinear_solvers.py. Construct an algebraic equationandperformtwoiterationsofNewton’smethodbyhandorwith theaidof SymPy. Find the corresponding size of jf.x/j anduse this as value forepswhen callingNewton. Thefunctionshouldthenalsoperformtwoiterationsandreturnthe sameapproximationto therootasyoucalculatedmanually. Implement this ideafor aunit test asa test functiontest_Newton(). Filename:test_Newton.py. Exercise6.6: Solvenonlinearequation foravibratingbeam An important engineering problem that arises in a lot of applications is the vibra- tionsofaclampedbeamwhere theotherend is free. Thisproblemcanbeanalyzed analytically,but thecalculationsboildowntosolving the followingnonlinearalge- braicequation: coshˇcosˇD 1;
zurück zum  Buch Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python
Titel
Programming for Computations – Python
Untertitel
A Gentle Introduction to Numerical Simulations with Python
Autoren
Svein Linge
Hans Petter Langtangen
Verlag
Springer Open
Datum
2016
Sprache
englisch
Lizenz
CC BY-NC 4.0
ISBN
978-3-319-32428-9
Abmessungen
17.8 x 25.4 cm
Seiten
248
Schlagwörter
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Kategorie
Informatik
Web-Books
Bibliothek
Datenschutz
Impressum
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python