Created
October 28, 2017 23:32
-
-
Save onionmk2/7b2c1aed0c8e0c5db97d315e94603c95 to your computer and use it in GitHub Desktop.
This file contains 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
void Main() | |
{ | |
Func<float, float> fx = x => | |
{ | |
return x * x - 612; | |
}; | |
Func<float, float> primeFx = x => | |
{ | |
return 2 * x; | |
}; | |
Func<float, float> diff = (x) => { | |
return x - fx(x) / primeFx(x); | |
}; | |
var initialGuess = 10; | |
var temp = diff(initialGuess); | |
temp.Dump(); | |
for (int i = 1; i < 6; i++) | |
{ | |
temp = diff(temp); | |
temp.Dump(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
result
35.6
26.39551
24.79064
24.73869
24.73863
24.73863