Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Notifications You must be signed in to change notification settings

shinbatsu/iteration-additer

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.