I'm having difficulty even beginning to solve this problem. All examples
that I have found are either too simple or way too complex to digest.

I want to to find the value S given a series of inputs. The function is
univariate but non-linear. S will always be between -3 .. 3.

I would like to use the Apache Commons library, as I have had prior
experience in other sections of the code.

For each time I want to solve my problem, I know the following information:

    double R     =250.0;
    double om1   =  5.0;
    double om2   = 15.0;
    double th21  = 29.07965;
    double th22  = 29.69008;
    double D_obs = th21 - th22;

The actual values will change between solutions, but they are fixed for any
one particular solution.

The value I want to find is:

    double S   = 0.0;

such that

    double d1     = delta(R,om1,th21,S);
    double d2     = delta(R,om2,th22,S);
    double D_calc = d1 - d2;

have values to make

    double minme = Math.abs(D_obs - D_calc);

a minimum. (ideally zero, but a minimum).

The function delta is defined as

public static double delta(double R, double om, double th2, double s)
{
    if(Math.abs(s) <= 0.0001) //is the displacement == 0?
    {
        return 0.0;
    }
    else
    {
        return 
Math.toDegrees((-1*Cos(th2)*s-R*Sin(om)+Sqrt(-1*Math.pow(Cos(th2),2)*Math.pow(s,2)+2*Cos(th2)*Sin(om)*R*s-Math.pow(Cos(om),2)*Math.pow(R,2)+Math.pow(R,2)+2*Math.pow(s,2)))/(Sin(th2)*s));
    }
}

where, for example, Cosis defined elsewhere as Math.cos(Math.toRadians(val))

Where/what can I read/do to get a start on this problem?


Thanks


Matthew

Reply via email to