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
5
votes
3 answers

efficient algorithms with array of increasing integers

I've been self teaching myself data structures in python and don't know if I'm overthinking (or underthinking!) the following question: My goal is come up with an efficient algorithm With the algorithm, my goal is to determine whether an integer i…
WycG
  • 141
  • 1
  • 1
  • 5
5
votes
4 answers

Using a recursive bisection algorithm to check if character is in string

I am currently doing the programming course over at edx and my instructions are as follows: Using the idea of bisection search, write a recursive algorithm that checks if a character is included within a string, as long as the string is in…
user3171116
  • 101
  • 1
  • 6
5
votes
5 answers

income tax calculation python

How do I go about making a for-loop with a range 70000 and above? I'm doing a for-loop for an income tax and when income is above 70000 there is a tax of 30%. Would i do something like for income in range(income-70000)? Well, at first i developed a…
user3014014
  • 751
  • 3
  • 10
  • 20
4
votes
3 answers

efficiently approximate real solution for polynomial function

I want to efficiently solve a degree-7 polynomial in k. For example, with the following set of 7 unconditional probabilities, p <- c(0.0496772, 0.04584501, 0.04210299, 0.04026439, 0.03844668, 0.03487194, 0.03137491) the overall event probability is…
jayb
  • 555
  • 3
  • 15
4
votes
4 answers

How to implement binary search in JavaScript

https://www.khanacademy.org/computing/computer-science/algorithms/binary-search/p/challenge-binary-search I was following the pseudo code to implement algorithm on the link but don't know what's wrong with my code. Here is my code : /* Returns…
Begginer
  • 93
  • 1
  • 1
  • 5
3
votes
2 answers

Rspec can't reproduce failures not even with minimal reproduction commands from bisect

We use Travis CI to maintain our project on git. The issue here is on Travis we have 2 processes running a random selection of specs each with different seed numbers, now when there is a failure, I try to run: the exact spec with the seed number…
Shalaby
  • 87
  • 1
  • 10
3
votes
1 answer

Python: bisection method

I am trying to write a program to determine the zeros of the given function (f(x) := ln((sin(x**(1/2))**3) + 2) - 1, using the bisection method. The values a and b, which are the initial values used in the bisection method, are inserted on the…
A.C
  • 33
  • 4
3
votes
1 answer

Problems with MATLAB nested statements and bisection

New to the site, but I'm trying to hone up on some MATLAB skills for work and school, and was looking for some help with the following: I want to write my own algorithm for finding the Hinf norm of a system using bisection, like the MATLAB function…
3
votes
1 answer

python bisect is O(n^2)?

I'm running a simple test to monitor how long does it take to sort-insert into a list with the bisect library import numpy as np import bisect def get_time(N): myl = [] a = time.time() for i in np.arange(N): …
elelias
  • 4,552
  • 5
  • 30
  • 45
3
votes
2 answers

Difference between two roots using bisection method in C?

I have written this C code to compare the root of two functions using bisection method. My first function (g(x)) executes correctly but the second one (h(x)) outputs "#1QO" on screen. I can't find what I did wrong in the code. Can you please…
A.DeMartini
  • 83
  • 1
  • 7
3
votes
2 answers

Gridwise application of the bisection method

I need to find roots for a generalized state space. That is, I have a discrete grid of dimensions grid=AxBx(...)xX, of which I do not know ex ante how many dimensions it has (the solution should be applicable to any grid.size) . I want to find the…
FooBar
  • 15,724
  • 19
  • 82
  • 171
3
votes
3 answers

Finding with bisection, not stoping

I have a problem with this method, when it gets "big" array in it. When I input array with like 10 numbers it's working fine. But if I insert like 10 milion numbers or even 20 the method never end and I can't find the problem. int bisection(int el,…
user3127680
  • 353
  • 2
  • 4
  • 13
2
votes
4 answers

Polynomial Root finding bisection

If I am finding the roots of a polynomial using the bisection method, and in some cases depending on the polynomial the roots might be negative or they may be positive. I understand I can determine if the roots are going to be negative or positive,…
user1139103
2
votes
1 answer

How to prevent Extension Bisect from disabling the extension with the feature I'm troubleshooting

A major VS Code extension (which comes installed with VS Code) isn't working for me. I've read bug reports for the behavior I'm seeing and the resolution isn't working for me either. I want to use Extension Bisect to troubleshoot which other…
2
votes
2 answers

Bisection method in matlab

function r=bisection(f,a,b,tol,nmax) % function r=bisection(f,a,b,tol,nmax) % inputs: f: function handle or string % a,b: the interval where there is a root % tol: error tolerance % nmax: max number of iterations % output: r: a…
hehex4
  • 43
  • 4
1
2
3
17 18