Hallo Everybody !(adsbygoogle = window.adsbygoogle || []).push({});

I have tried to look in the previous posts, but I haven’t find something useful.

I am looking for an iteration function to help me to solve following issue.

I have got three values, let’s say

A which is a constant (it is determined), that can be positive, negative or 0

B which is variable that can be positive, negative or 0

C which is variable that varies between two fixed values (typically 0 and 1).

The scope of the function would be to vary C in order to get B as close as possible to A.

C and A are not linked by any relation, let’s say that A is a target value.

C and B are proportional, but they are not linked by a known function.

Therefore the algorithm should :

Vary C of a value, then verify the error between A and B and should this error be positive or negative, vary C consequently.

I hope to have been clear enough.

Is there anybody who knows a similar algorithm ?

Many thanks for your help !

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Iteration function

**Physics Forums | Science Articles, Homework Help, Discussion**