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
-1
votes
1 answer

Calling a bisection method root finiding function and calingit to solve any function in python

I have written a general bisection method to find roots of the provided function, I want to call it to solve a quadratic function. here's my generalroot.py # generalroot.py # determines the root of any general function def root_bisection(f, a, b,…
bhjghjh
  • 889
  • 3
  • 16
  • 42
-1
votes
1 answer

C++ while loop using bisection method. Help on break

I need some help here. Please excuse the complexity of the code. Basically, I am looking to use the bisection method to find a value "Theta" and each i increment. I know that all the calculations work fine when I know the Theta, and I have the code…
Fitzy
  • 113
  • 1
  • 2
  • 9
-1
votes
1 answer

Plot loop bisection method matlab

I have the next script in Matlab it's the bisection method function root = biseccion(f,a,b,epsilon, max) if (f(a)*f(b) >= 0) disp('f(a) *f(b) >= 0'); root = 'Can't find the root'; return; else …
Edgar Pisxid
  • 79
  • 2
  • 12
-1
votes
1 answer

Root of polynomial using bisection

I'm new to python and i'm having a hard time trying to find the root of a polynomial via using the bisection method. So far I have 2 methods. One for evaluating the polynomial at value x def eval(x, poly): """ Evaluate the polynomial at the value…
dabrams493
  • 61
  • 6
-1
votes
2 answers

What's the root and what's the useful of finding the root in algorithms like bisection?

I already solved a bisection algorithm using C++ as a language, I think the main purpose is to find the root. I understood the whole algorithm, but I didn't understand what the root will do or what will be the the purpose of root if we find it.
Caffe Latte
  • 1,693
  • 1
  • 14
  • 32
-1
votes
1 answer

Writing values to sheet after each iteration

This code is an iterative solver. How do I write out key values onto an Excel spreadsheet after each iteration? e.g. the iteration number, the Xl, Xu, Xmid, and the error of each iteration. Option Explicit Public Function srkEquation(Temperature,…
-1
votes
3 answers

Bisection Search on the Lowest Payment on Credit Card Debt: Answers are always way off

My code: balance = 320000 annualInterestRate = 0.2 originalBalance = balance month = 1 monthly_interest = annualInterestRate / 12 low = originalBalance/12 high = (originalBalance*(1 + monthly_interest)**12)/12 epsilon = 0.01 min_payment = (high +…
user2066771
  • 153
  • 2
  • 4
  • 11
-2
votes
1 answer

Bisection method

I want to make a Python program that will run a bisection method to determine the root of: 2*3.14*(x+0.25)**2 + 2*3.14*(x+0.25)*(1000/(3.14*x**2)) The Bisection method is a numerical method for estimating the roots of a polynomial f(x). Are there…
-2
votes
1 answer

Can someone explain to me why doesn't this piece of code work?

annual_salary = int(input("Your annual salary ")) semi_annual_raise = 0.07 r = 0.04 down_payment = 250000 epsilon = 100 low = 0 high = 10000 guess = (high + low)//2 best_saving_rate = (guess/10000) months = 0 current_savings = 0 steps = 0 while…
bassam ch
  • 1
  • 3
-2
votes
1 answer

My Bisection method in c++

I'm study Computer science in 4 degree and i'm trouble with bisection method implementation in c++. The error is about the code run one time and end, i tried some changes but any good result :( If you can help me, please do it. I saw some…
Gui
  • 1
-2
votes
2 answers

Having trouble understanding bisection searching and recursion

Here's the problem I'm trying to wrap my head around: We can use the idea of bisection search to determine if a character is in a string, so long as the string is sorted in alphabetical order. First, test the middle character of a string against…
-2
votes
2 answers

Median sort a list in unordered fashion

What's the best way of sorting a python list in an unordered fashion according to the median of value positions in the list? Suppose: a = [1, 3 ,6, 7, 10, 12, 17] I'm looking for this: a = [1, 17, 7, 3, 12, 6, 10] Meaning, the list now looks like…
Yasin
  • 609
  • 1
  • 10
  • 22
-3
votes
1 answer

How is the logic reasoning done in these three codes?

def findRoot1(x, power, epsilon): low = 0 high = x ans = (high+low)/2.0 while abs(ans**power - x) > epsilon: if ans**power < x: low = ans else: high = ans ans = (high+low)/2.0 …
Eliza
  • 101
  • 1
  • 1
  • 9
-4
votes
1 answer

Problem with Bisection method on Visual Basic

Here is my code for a bisection method. If I input 4 and 5 the program loops infinitely. There is a problem with it running. Sub TheBisectionMethod1() Dim a, b As Double 'Taking two variables, A and B Console.Write(vbLf & "Input A:…
loco3424
  • 23
  • 2
  • 6
-5
votes
1 answer

Syntax Error using CoreMath "public double..."

This is the error that I receive: Multiple markers at this line - Syntax error on token "double", { expected - Syntax error, insert "interface Identifier" to complete InterfaceHeader - Syntax error on token "double", @…
Jammer
  • 1
  • 1
1 2 3
17
18