Rates of change, Slope at 7

Been a longtime :sweat_smile:

void GetSlopeAroundPointX(int x)
{
    double x2 = x + 0.1,  x1 = x - 0.1;
    double y2 = Math.Pow(2.0, x2), y1 = Math.Pow(2.0, x1);
    double dx = x2 - x1;
    double dy = y2 - y1;
    double slope = dy / dx;

    System.Console.WriteLine($"{dy:0.#}({y2:0.#} - {y1:0.#})/{dx:0.#}({x2:0.#}-{x1:0.#}) = {slope:0.#}");
}
GetSlopeAroundPointX(7);

17.8(137.2 - 119.4)/0.2(7.1-6.9) = 88.8

1 Like

Keep up the good work!

Privacy & Terms