Thursday, November 23, 2017

We continue our discussion on inverse modeling to represent the system. An inverse model is a mathematical model that fits experimental data. It aims to provide a best fit to the data. We use the least squares error minimization to fit the data points. Minimizing Chi Square requires that we evaluate the model based on the parameters. One way to do this is to find where the derivatives with regard to the parameters are zero.  This results in a general set of non-linear equations.
We talk about linear regression analysis next. This kind of analysis fits a line to a scatter plot of data points. The same least squares error discussed earlier also helps center the line to the data plot which we call a good fit. The model parameters are adjusted to determine this fit by minimizing error.
To determine the best parameters for the slope  and intercept  of the line, we calculate the partial derivatives with respect to them and set  them to zero. This yields two equations to be solved for two unknowns. The standard error of the estimate quantifies the standard deviation of the data at a given value of the independent variable. Standard error of slope and intercept can be used to place confidence intervals.
One of the best advantage of a linear regression is the prediction with regard to time as in independent variable. When the data point have many factors contributing to their occurrence, a linear regression gives an immediate ability to predict where the next occurrence may happen. This is far easier to do than come with up a model that behaves as good fit for all the data points. It gives an indication of the trend which is generally more helpful than the data points themselves. Also a scatter plot s only changing in one dependent variable in conjunction with the independent variable. Thus lets us pick the dimension we consider to fit the linear regression independent of others.
Lastly, the linear regression also gives an indication of how much the data is adhering to the trend via the estimation of errors.

A MagicValue X is defined as one that satisfies the inequation KX <= Sum from M to N of Factorial(I) x Fibonacci(I) such that X is maximum
Given, M, N, and K approximate X
        static double Fib(int x)
        {
           if (x <= 1) return 1;
           return Fib(x-1) + Fib(x-2);
        }
        static double Fact(int x)
        {
            double result = 1;
            while (x > 0)
            {
                result *= x;
                x--;
            }
            return result;
        }
        static int GetMagicValue(int N, int M, int K)
        {
            double P = 0;
            double prev = P;
            for (int k = M; k >= N; k--)
            {
                double fib = Fib(k);
                double fact = Fact(k);
                double product = fib * fact;
                prev = P;
                P += product;
            }
            double result = P/K;
            return Convert.ToInt32(Math.Floor(result));
        }  

No comments:

Post a Comment