Questions tagged [bisection]

Anything related to a class of algorithms where the result is found by searching either the upper or the lower half of a sorted set of items and repeating this procedure recursively. Commonly used to refer to the bisection method (to find a root of an equation) or to the bisection search algorithm (to search a sorted list for a matching element).

Anything related to a class of algorithms where the result is found by searching either the upper or the lower half of a sorted set of items and repeating this procedure recursively, narrowing the search at each step.

Two common examples of bisection algorithms are:

257 questions
0
votes
0 answers

C code, root finding algorithm

I'm using the bisection method to find the root of function in the domain from 70*10^9 to 250*10^9, but the output is always the upper bound, i.e 250*10^9. The function is a definite integral, I don't know where I did wrong. Thanks in…
YYCCC
  • 1
0
votes
1 answer

bisection root finding segmentation fault

I use following code to find roots of functions using a simple bisection algorithm #include #include typedef float (*continous_function)(float); static const float epsilon = 0.0000001; #if __STDC__ static __inline float…
yasar
  • 13,158
  • 28
  • 95
  • 160
0
votes
1 answer

Function as parameter of a function, using bisection method C++

// Function as parameter of a function #include #include #include using namespace std; const double PI = 4 * atan(1.0); // tan^(-1)(1) == pi/4 then 4*(pi/4)== pi typedef double(*FD2D)(double); double root(FD2D,…
maurux
  • 33
  • 1
  • 8
0
votes
1 answer

Logical error in bisection algorithm code

I am writing a program to demonstrate the bisection algorithm(from numerical methods). What I am doing is this: defined a function F(int), which takes the integer and returns the value of the polynomial at that integer. In the bisection()…
VDC117
  • 3
  • 3
0
votes
2 answers

Python Bisection search code - "cannot concatenate 'str' and 'int' objects" error

I am trying to make a program which takes an alphabetized string and looks for a particular character within that string by breaking the string up into 2 parts, to find the character that is in the middle, either on the half less than the middle, or…
0
votes
1 answer

showing how numerical solution coming close to the real selution

I want to plot the graph of the numerical solution of bisection method and show how it get close to the real solution . my code: % f=input('please enter the function:'); % xL=input('please enter the limits .from:'); % XR=input('to:'); %…
user3316789
  • 67
  • 1
  • 1
  • 3
0
votes
1 answer

plotting data from other function

I'm trying to do some kind of bisection method program that show how i get to the final answer by plotting everything. Do you know why in my file i can't plot data from function in another m file? There is that error: mainhazia 27 end Cannot…
user3316789
  • 67
  • 1
  • 1
  • 3
0
votes
1 answer

My bisection code in python doesnt return the root

I am trying to find a good approximation to the root of a function using a bisection algorithm, however, when I run the code it doesnt return the root (c). Here is my code. import numpy as np import matplotlib.pyplot as plt x =…
Truxton Boyce
  • 183
  • 2
  • 2
  • 7
0
votes
1 answer

Bisection Search in Python - Find lowest payment over one year

I've been going nuts about this problem for hours, and I've been redoing it over and over! At this point I think I'm actually seeing numbers flying around me. Anyway, I'm supposed to write a program that finds the correct amount of money to pay each…
michaelw90
  • 513
  • 2
  • 9
  • 23
0
votes
1 answer

bisection search using max() function

Why did we use max function. Can't we straight away evaluate high to x. That would also achieve our purpose. So, how does the algorithm improves with this max() function? x=25 epsilon=0.01 numGuesses= 0 low =0.0 high = max(1.0,x) ans = (high+low)/…
user3995169
  • 145
  • 1
  • 9
0
votes
2 answers

Can someone help improve my Scala bisection answer? What is wrong?

Implement the bisection method with the following specification: Input: Function f, values low and high, error range epsilon. `enter code here`Precondition: low0 and…
0
votes
1 answer

C++ Bisection Algorithm for a Quadratic Equation

I had a prior snag with this problem that was resolved but I felt that since the nature of my new issue is not related to successful compiling, rather to actual logic of the code, that it would be acceptable to make a new topic. Here is my code so…
Dazed_and_confused
  • 2,065
  • 2
  • 14
  • 10
0
votes
1 answer

2D Bisection Method - Roots Finding

I'm trying to use a Bisection Method to solve two highly nonlinear equations. Let us say; f(x,y) = 0 with degree eight and g(x,y) = 0 with degree six; I need a matlab code for 2D Bisection Method to solve f(x,y) = 0 and g(x,y) = 0 and find all…
CS2013
  • 133
  • 1
  • 5
  • 14
0
votes
1 answer

Recursive bisection method program stopped working

I have a problem with bisection method (recursive implementation) that doesn't work. The program just crashes after entering a&b values ... #include #include #include #define e 0.0001 #define dbg 1 using namespace…
Marian Pavel
  • 31
  • 2
  • 6
0
votes
1 answer

Conditionals and bisection search. (for python.)

I'm a beginner in programming and I have a two basic question. The first concerns conditionals. If I have an if and else statement and the condition is met for the "if" statement, when it's finished with the if, the program will skip the else…
copper
  • 683
  • 1
  • 6
  • 6