0
$\begingroup$

I used the InterpolatingPolynomial function to get a polynomial that meets my points.

But I noticed that there is a deviation in the final intervals.

ClearAll["Global`*"]
dados16={{10,0.37},{15,0.47},{20,0.54},{25,0.61},{30,0.70},{40,0.80},{50,0.90},{60,1.01},{70,1.10},{80,1.20},{90,1.31},{100,1.42},{110,1.53}};
B16[l_]=InterpolatingPolynomial[dados16,l]//Expand;
Plot[B16[l],{l,0,110},Epilog->{{Red,PointSize[.02],Point[dados16]}}]

enter image description here

What would be the best function to have a better result?

$\endgroup$
  • $\begingroup$ Can you use Interpolation or you do want to have the symbolic formula of the polynomial? Can you use other types of polynomials, say, found with FindFormula? $\endgroup$ – Anton Antonov Sep 19 at 17:27
  • $\begingroup$ Yes. Could be through these functions that commented. Could you demonstrate in an answer? $\endgroup$ – LCarvalho Sep 19 at 17:47
2
$\begingroup$

Basically in all variants below we are trying to not let high degree polynomials be used. (Less than degree 12 produced by InterpolatingPolynomial.)

Interpolation

Using Interpolation instead of InterpolatingPolynomial.

Clear[B16]
B16[l_] := 
  Evaluate[Interpolation[dados16, l, InterpolationOrder -> 2] // 
    Expand];
Plot[B16[l], {l, Min[dados16[[All, 1]]], Max[dados16[[All, 1]]]}, 
 Epilog -> {{Red, PointSize[.02], Point[dados16]}}]

enter image description here

FindFormula

FindFormula does not give better result than InterpolatingPolynomial. (Obviously "just" a fit.)

Clear[FF]
FF[x_] := 
  Evaluate[FindFormula[dados16, x, PerformanceGoal -> "Speed"]];
Plot[FF[l], {l, Min[dados16[[All, 1]]], Max[dados16[[All, 1]]]}, 
 Epilog -> {{Red, PointSize[.02], Point[dados16]}}, PlotRange -> All]

enter image description here

Chebyshev polynomials

Better results are obtained with Chebyshev polynomials (ChebyshevT). (If of interest I can expand on that.)

enter image description here

$\endgroup$
  • $\begingroup$ The goal was to get a function that would give me more accurate values. I tested B16 [32] and I got a satisfactory value: 0.728533. Thanks for your reply $\endgroup$ – LCarvalho Sep 19 at 19:25
  • 1
    $\begingroup$ Sure, no problem! $\endgroup$ – Anton Antonov Sep 19 at 19:39
  • $\begingroup$ @Anton how exactly did you do it with ChebyshevT? Thanks $\endgroup$ – floyd17 Sep 22 at 10:51
  • 1
    $\begingroup$ @floyd17 The software monad QRMon has functions for doing Quantile Regression and Least Squares Fit using a user provided basis of functions, with a default basis made with Chebyshev polynomials. See the section "Default basis to fit (using Chebyshev polynomials)" in this QRMon document. $\endgroup$ – Anton Antonov Sep 22 at 13:00
2
$\begingroup$

Does the function have to go through all of the points? If not, how about fitting instead of interpolating.

dados16 = {{10, 0.37}, {15, 0.47}, {20, 0.54}, {25, 0.61}, {30, 0.70}, {40, 0.80},{50, 0.90}, {60, 1.01}, {70, 1.10}, {80, 1.20}, {90, 1.31}, {100, 1.42}, {110, 1.53}};

fit = Fit[dados16, {1, x, x^(1/2)}, x]

0.104065 + 0.0701194 Sqrt[x] + 0.00609645 x

Plot[fit, {x, 0, 110}, 
 Epilog -> {{Red, PointSize[.02], Point[dados16]}}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.