Created
May 1, 2022 07:06
-
-
Save Aldhanekaa/3368d3049a69520fea0b72d26ba1089a to your computer and use it in GitHub Desktop.
exponential vs relational growth overtime solver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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