# How can I find formula of the function of this graph?

I want to plot the graph in this picture, but I don't know formula of the function. I tried

 f[x_] := a x^9 + b x^8 + c x^7 + d x^6 + e x^5 + n x^4 + g x^3 +
h x^2 + k x + l ;
NSolve[{f[-2] == -2, f[2] == 2, f[4] == 4, f[0] == 6, f[1.5] == 3,
f'[0] == 0, f'[2.5] == 0, f'[1.5] == 0, f[2.5] == 1.5,
f'[1.2] == 0}, {a, b, c, d, e, n, g, h, k, l}, Reals]


I got

{{a -> 0.23626, b -> -2.61292, c -> 9.81292, d -> -9.83145, e -> -26.1737, n -> 76.7269, g -> -67.1827, h -> 16.1222, k -> 0., l -> 6.}}

But the result don't exactly.

How can I find formula of the function of this graph?

We can extract the data from the picture ,then use the "FindFormula" to find formula of the function.(It is difficult to extract data directly through image processing, so I erased interference in the picture firstly) .

imgdat = Sort[ImageValuePositions[Thinning@ColorNegate@Binarize[IMG], 1]];
dat = ({Rescale[#1, MinMax[imgdat[[;; , 1]]], {-2.1, 4.4}], Rescale[#2, MinMax[imgdat[[;; , 2]]], {-2.7, 6.4}]} & @@@ imgdat);
fits = FindFormula[dat, x, 1, "Score" ]
Show[ListPlot[dat],
Plot[First@fits, {x, -2.1, 4.4}, PlotRange -> All,
PlotStyle -> Directive[Red, Thick]], AspectRatio -> 1]


maybe help.

• Another approach is used here mapleprimes.com/questions/… . – user64494 Sep 9 '17 at 18:27
• @jiaoeyuhushu Where can I put my picture? – minhthien_2016 Sep 10 '17 at 7:38
• If my picture has name is pic.PNG, how to put it in your code? – minhthien_2016 Sep 10 '17 at 8:36
• @toandhsp RemoveAlphaChannel[pic.PNG] or Save as pic.JPG – jiaoeyushushu Sep 10 '17 at 9:41
• How I input pic.JPG? Where the command contain pic.JPG? – minhthien_2016 Sep 10 '17 at 9:47