Mathematica: Parabolic Fit using Predefined Program and ErrorBarPlots Module

In summary: You can try using PseudoInverse[matD] instead, which uses a singular value decomposition to invert matrices and may be more accurate in this situation. Alternatively, you can try using high precision numbers (e.g. 100 digits instead of the default 16) to see if that improves the accuracy of the inversion. In summary, the conversation includes using a predefined program to manipulate data and encountering an error while trying to invert a matrix due to its poor condition. Suggestions for resolving the issue include using PseudoInverse or high precision numbers.
  • #1
Hoiya
2
0
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?
 
Physics news on Phys.org
  • #2
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.
 

1. What is Mathematica and how is it used in scientific research?

Mathematica is a computational software program used for a wide range of scientific and technical applications. It is commonly used in research to perform complex mathematical calculations, create visualizations, and analyze data.

2. How does the Parabolic Fit using Predefined Program work in Mathematica?

The Parabolic Fit using Predefined Program in Mathematica allows users to fit a parabolic curve to a set of data points. This is useful for analyzing and predicting trends in experimental data. The predefined program uses a least-squares method to find the best-fit parabola for the data.

3. Can I customize the Parabolic Fit using Predefined Program in Mathematica?

Yes, the predefined program can be customized to fit different types of data and to adjust the fitting parameters. Users can also add additional features to the graph, such as error bars, to better visualize the data.

4. What is the ErrorBarPlots Module in Mathematica?

The ErrorBarPlots Module in Mathematica is a built-in function that allows users to add error bars to their graphs. Error bars represent the uncertainty or variability in the data points, providing a visual representation of the accuracy of the data.

5. How can I use Mathematica for analyzing experimental data with error bars?

To analyze experimental data with error bars in Mathematica, users can first use the ErrorBarPlots Module to add error bars to the data points. Then, the Parabolic Fit using Predefined Program can be used to fit a parabolic curve to the data. This can help identify any trends or relationships within the data and make predictions based on the fit curve.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
4K
  • Programming and Computer Science
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
275
Back
Top