Это мой прогресс на данный момент:
Код: Выделить всё
//Want to find e^x.
//Global variable of 'E' human enterable value.
//e^x = 1 + (x^1 / 1!) + (X^2 / 2!) + (X^3 / 3!) + ...
int indexer = 0; // is used for the x^0, x^1, x^2
int e = E; // is the natural e
long n = 1; // is the 1, 2, 3, or whole numbers
long nFac = n; // is the factorial
double e2, e3, e4; //e2 ~ e4 is the manipulation of the base equation of n + (x^n/n!)
while (nFac < long.MaxValue / n) //allowing for the decimal place to grow to the right of the decimal
{
nFac = nFac * n; // !n is created in this line
e = e + 1; // constant e is enlarged by the value of 1.
e2 = e >> indexer; // raise to the power of indexer over "e"
e3 = e2 / nFac; //division of the (rasied to the power of indexer over "e") / !n or the Factorial
e4 = e3 / 10; //Removing the value of 1 by division of 10 and setting the values in a double format.
n++; indexer++; //iterattion of 'n' and 'indexer' by 1 whole number
Console.WriteLine($"e^x = {e4}"); //console.writeline or print the value we get.
//Should find e^x`
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... er-of-x-ex