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:

233 questions
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
  • 135
  • 1
  • 9
0
votes
0 answers

String equation to vb with exponents for bisection method in VB

im trying to create something something similar to this, parsing string to equation with vb now, my problem is is the exponents, can anyone help me with this, or is there any easier way to convert that string to a mathematical equation? func =…
user2124478
  • 27
  • 1
  • 6
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
  • 1,655
  • 2
  • 11
  • 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
  • 123
  • 1
  • 4
  • 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
  • 1
  • 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
  • 643
  • 1
  • 6
  • 6
0
votes
1 answer

Iterative solution to finding Longest Increasing Subsequence using Python

I am trying to implement an iterative solution for Longest Increasing Subsequence using bisect. My implementation is failing at some point. Help me fix it. Implementation: from bisect import bisect def lis_iterative(seq): buff = [] for n in…
Shankar
  • 2,938
  • 4
  • 22
  • 38
0
votes
3 answers

Python: Unexpected conditional activation in simple bisection search game

I'm wrote some code to determine a secret number between 0 and 100. The user tells the machine the guessed number (which is half the range) is either to high, too low or just right. Based on the input, the machine used bisection search to adjust the…
KGS
  • 217
  • 2
  • 4
  • 9
0
votes
1 answer

Bisection method to calculate credit card repayments

I'm taking the course 6.00.1x Introduction to Computer Science and Programming. I have been asked to come up with a program that calculates the minimum repayments needed to pay off the credit card balance within a year. For this, I need to use…
0
votes
2 answers

How can I optimize bisection-method for polynomial root finding in Java?

double findaroot(double x1, double x2){ //finds the root between two values double gap = Math.abs(x1 - x2); //find the initial interval while(gap > INTERVAL) { //check for precision gap = gap / 2; //halve the interval …
0
votes
2 answers

Python Bisection search overshoots target

I have to create a code to find the exact payment, to the cent, needed to pay off a loan in 12 months using bisection. The code I created for this works but it overshoots it's target. The loan will be payed off within the 12 months but after making…
Pim
  • 35
  • 1
  • 1
  • 3
0
votes
0 answers

Find string using a bisectional search in linked list

I have a Find function that searches a linked list of strings sequentially. This Find functions finds the string and returns it. I also have a remove function that uses this Find function and removes the string from the linked list. Both of my…
WestonBuckeye
  • 45
  • 2
  • 3
  • 11
0
votes
2 answers

Bisection method in CUDA

I was trying to implement the Bisection Method in CUDA. This method is capable to approximate the eigenvalues from an application (Bisection Method). I have some questions about how to do it. Here is my code: #include #include…
ChrisID58
  • 55
  • 6
0
votes
2 answers

Using Bisection Search on Lowest Payments on Credit Card debt and

My code: monthlyInterestRate = annualInterestRate/12.0 low = balance/12 high = (balance*(1+monthlyInterestRate)**12)/12 guess = (low+high)/2 unpaidBalance = balance month = 1 while True: unpaidBalance= unpaidBalance-guess while…
user2066771
  • 133
  • 2
  • 4
  • 11