Skip to content

Instantly share code, notes, and snippets.

@Aldhanekaa
Created May 1, 2022 07:06
Show Gist options
  • Select an option

  • Save Aldhanekaa/3368d3049a69520fea0b72d26ba1089a to your computer and use it in GitHub Desktop.

Select an option

Save Aldhanekaa/3368d3049a69520fea0b72d26ba1089a to your computer and use it in GitHub Desktop.
exponential vs relational growth overtime solver
import 'dart:math';
void main() {
double expoIntial = 2;
double expoB = 3;
double relaInitial = 5 ;
double relaB = 11;
int x = 1;
while (true) {
print(x);
if (countExpo(initial: expoIntial, b: expoB, x: x) >= countRelation(initial:relaInitial, b: relaB, x: x )) {
print("Found! $x");
break;
}
x++;
continue;
}
}
double countExpo({required double initial, required double b, int x = 1}) {
return initial * pow(b,x-1);
}
double countRelation({required double initial, required double b, int x = 1}) {
return (initial - b) + (b * x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment