Created
April 29, 2020 13:09
-
-
Save AspenForester/a75ad72f325e7439c415df26d37e9f9b to your computer and use it in GitHub Desktop.
Exponentiation, produces the same results as the .Net method [math]::exp(). Uses the Factorial function in another of my gists
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
function exp ($x) | |
{ | |
[double]$sum = 1 | |
foreach ($n in (1..100)) | |
{ | |
$sum += [Double]([math]::Pow($x, $n)/[double](Factorial $n)) | |
} | |
$sum | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment