Giter VIP home page Giter VIP logo

bisection-method-in-python's Introduction

Bisection method of solving an equation

It is a quite simple method of solving an equation numerically in cases where the exact solution is difficuilt to find. In this method we repetedly bisect an interval into halves until we reach the desired accuracy. It is a consequence of well known mean value theorem of calculus.

I have used the equation x - cos(x) = 0 as a demonstration. This problem is also on the book "Quantum Mechanics" of Schaum Outlines page 256. They have done that in FORTRAN though while my code is on Python (2.7.13). My C version of the same problem can be found here.

The code was written under Debian GNU/Linux in Python IDLE under Python.

$ python --version
Python 2.7.13

Here's the code running. The value obtained after 16 iterations can be verified with the book or other sources as well. Also note that we obtained exactly the same value using C as well. N

USAGE

If your maximum iterations is say 20 then you can use,

python bisection.py 20

Alternatively you can also chmod +x bisection.py and then

./bisection.py 20

LICENSE

GNU_GPL_v3.0

Totally RMS approved! While you're at it, please check out GNU and Free Software Foundation as well!

bisection-method-in-python's People

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

getteli

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.