Skip to content

First Principles Official Documentation

John Seong edited this page Feb 14, 2022 · 17 revisions

Hola, Senõrita!

First Principles is an interactive module where the user can freely tinker with different types of graphs and their derivatives, such as the three periodic functions, the quadratic parabola, the cubic function, the square root function, both logarithm, and natural logarithm graphs, etc. Feel free to make any contributions in the future major updates! We will be trying to keep everything up-to-date here as well.


How First Principles Calculate the Derivative

First Principles uses the three-point method in order to numerically predict the instantaneous rate of change of the given function. All derivative graphs are affected by the transformations that have been made to the original function and are bound to a certain limit where the graph does not endlessly approach positive or negative infinity.

// Power of N Function
if (functionType == FunctionType.Power)
{
    yValue = transA * (float)(Mathf.Pow(transK * (xValue - transD), power) + transC);

    // Differentiate numerically using the centred three-point method
    dyValue = ((transA * (float)(Mathf.Pow(transK * ((xValue + hValue) - transD), power) + transC)) - (transA * (float)(Mathf.Pow(transK * ((xValue - hValue) - transD), power) + transC))) / (hValue * 2);
}

// Exponential Function
else if (functionType == FunctionType.Exponential)
{
    yValue = transA * (float)(Mathf.Pow(transK * baseN, (xValue - transD)) + transC);

    // Differentiate numerically using the centred three-point method
    dyValue = ((transA * (float)(Mathf.Pow(transK * baseN, ((xValue + hValue) - transD)) + transC)) - (transA * (float)(Mathf.Pow(transK * baseN, ((xValue - hValue) - transD)) + transC))) / (hValue * 2);
}
Clone this wiki locally