Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python bisection method

def bisection(f, a, b, eps):
  if f(a) * f(b) >= 0:
    raise BaseException("Wrong interval!")
  if a > b:
    a, b = b, a
  n = 0
  x = (a + b) / 2
  while b - a >= 2*eps:
    if f(x) == 0:
      return x, n
    elif f(a) * f(x) < 0:
      b = x
    else:
      a = x
    x  = (a + b) / 2
    n += 1
  return x, n
Comment

PREVIOUS NEXT
Code Example
Python :: run every minute python 
Python :: discord command addrole python 
Python :: Removing punctuation in Python 
Python :: python has duplicates 
Python :: pandas dataframe hist title 
Python :: hcf program in python 
Python :: log transform pandas dataframe 
Python :: django import settings 
Python :: length ofarray in ptyon 
Python :: python Split a file path into root and extension 
Python :: pages.User Settings.user: (fields.W342) Setting unique=True on a Foreign Key 
Python :: pystfp how to listdir 
Python :: django check if url safe 
Python :: line number in logging python 
Python :: find todays date in python 
Python :: pylint: disable=unused-argument 
Python :: how to add a column to a pandas df 
Python :: is there a replacement for ternary operator in python 
Python :: set threshold resnet18 pytorch 
Python :: python index where true 
Python :: pandas datetime to date 
Python :: button icon pyqt5 
Python :: python logger format time 
Python :: pytube search feature 
Python :: How to Add a Progress Bar into Pandas Apply 
Python :: python discord bot wait for response 
Python :: python get date next week 
Python :: convert string to operator python 
Python :: python spearman correlation 
Python :: kivy date widget 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =