Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica: parabolic fit

  1. May 14, 2012 #1
    I'm using a predefinied program... but I don't know because give me this error:

    Clear["Global`*"]

    Remove["Global`*"]

    << "ErrorBarPlots`"


    xdata = {180, 200, 220, 240, 260, 280, 300, 320, 340, 360}

    {180, 200, 220, 240, 260, 280, 300, 320, 340, 360}


    ax = First[xdata]

    180

    bx = Last[xdata]

    360

    apx = 2./(bx - ax)

    0.0111111

    bpx = (bx + ax)/(bx - ax)

    3

    xdata1 = xdata*apx - bpx

    {-1., -0.777778, -0.555556, -0.333333, -0.111111, 0.111111, 0.333333, \
    0.555556, 0.777778, 1.}


    xdata1 = xdata

    {180, 200, 220, 240, 260, 280, 300, 320, 340, 360}


    ydata1 = {13.8, 16.3, 18.2, 19.7, 20.4, 20.4, 19.8, 18.7, 17, 15}

    {13.8, 16.3, 18.2, 19.7, 20.4, 20.4, 19.8, 18.7, 17, 15}


    s = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}

    {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}


    numpt = 10

    10


    matD = {{Sum[1/(s[])^2, {i, numpt}],
    Sum[xdata1[]/(s[])^2, {i, numpt}],
    Sum[(xdata1[])^2/(s[])^2, {i, numpt}]}, {Sum[
    xdata1[]/(s[])^2, {i, numpt}],
    Sum[(xdata1[])^2/(s[])^2, {i, numpt}],
    Sum[(xdata1[])^3/(s[])^2, {i,
    numpt}]}, {Sum[(xdata1[])^2/(s[])^2, {i, numpt}],
    Sum[(xdata1[])^3/(s[])^2, {i, numpt}],
    Sum[(xdata1[])^4/(s[])^2, {i, numpt}]}}

    {{999.9999999999999`, 269999.99999999994`,
    7.619999999999999`*^7}, {269999.99999999994`, 7.619999999999999`*^7,
    2.2355999999999996`*^10}, {7.619999999999999`*^7,
    2.2355999999999996`*^10, 6.777167999999999`*^12}}

    MatrixForm[matD]

    \!\(\*
    TagBox[
    RowBox[{"(", "", GridBox[{
    {"999.9999999999999`", "269999.99999999994`", "7.619999999999999`*^7"},
    {"269999.99999999994`", "7.619999999999999`*^7",
    "2.2355999999999996`*^10"},
    {"7.619999999999999`*^7", "2.2355999999999996`*^10",
    "6.777167999999999`*^12"}
    },
    GridBoxAlignment->{
    "Columns" -> {{Center}}, "ColumnsIndexed" -> {},
    "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
    GridBoxSpacings->{"Columns" -> {
    Offset[0.27999999999999997`], {
    Offset[0.7]},
    Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
    Offset[0.2], {
    Offset[0.4]},
    Offset[0.2]}, "RowsIndexed" -> {}}], "", ")"}],
    Function[BoxForm`e$,
    MatrixForm[BoxForm`e$]]]\)


    matDinver = Inverse[matD]

    Inverse::luc: Result for Inverse of badly conditioned matrix {{1000.,270000.,7.62*10^7},{270000.,7.62*10^7,2.2356*10^10},{7.62*10^7,2.2356*10^10,6.77717*10^12}} may contain significant numerical errors. >>

    {{0.5965, -0.00453068, 8.23864*10^-6}, {-0.00453068,
    0.0000348201, -6.39205*10^-8}, {8.23864*10^-6, -6.39205*10^-8,
    1.18371*10^-10}}

    can anybody help me?
     
  2. jcsd
  3. May 14, 2012 #2

    Dale

    Staff: Mentor

    If you do SingularValueList[matD] you see that your largest singular value is 6.8E12 and the smallest is 1.7E0. So a matrix inversion can be expected to lose about 12 digits of precision. This isn't an issue with Mathematica, it is a feature of the matrix itself.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook