Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Additer — Adaptive Iteration Method

This project visualizes the Adaptive Iteration Method (Additer) for finding the value of a variable where a linear function intersects a given true value.

What the program does

  1. Defines a linear function: $y = (1 + \alpha)x + \beta$

  2. The goal is to find x such that: $y = \text{True Value}$

  3. The program starts from an initial value x0 and adjusts it iteratively to reduce the error. The step size is adaptive:

    • small error → small step
    • large error → large step
  4. Each iteration is logged and visualized on a plot.

Plot visualization

The plot shows:

  • the line $y = f(x)$
  • the line $y = x$
  • a horizontal line for the true value
  • the steps of the Additer method

This allows visual understanding of how the method converges to the solution.

Main parameters

Constants are defined at the top of the file:

  • TRUE_VALUE — the target true value
  • ALPHA_PERCENT, BETA_PERCENT — function parameters
  • LR_LOW, LR_DEFAULT, LR_HIGH — step sizes
  • error thresholds

These parameters can be adjusted as needed.

How the method works

The function additer_alternative():

  1. Takes the current x

  2. Computes y

  3. Computes the error

  4. Updates x:

    x_next = x - lr * error
  5. Adjusts lr depending on error magnitude

  6. Stops if the error is below a threshold

Running the program

Simply run:

python main.py

Output:

  • values for each iteration
  • final error
  • a visual plot of the iterative steps

Use cases

This code can be used for:

  • learning adaptive iteration methods
  • demonstrating guaranteed convergence
  • visualizing root-finding of a linear function

About

The Additer finds x where a linear function reaches a target value. It shows each step and convergence on a graph.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages