Message Boards Message Boards


Inconsistent Fit

Posted 1 year ago
6 Replies
0 Total Likes


I want Wolfram|Alpha to give me, simultaneously, the best fit for a group of data. I put:

fit {{1,1},{2,5},{3,9},{4,9},{5,13},{6,22},{7,23},{8,26},

and it gave me an answer. Then, I tried the exact same query the day after, and it says it does not understand the query! If I shorten the chain to less values, then it works. Not sure what is going on. I am a Pro User. Thanks!!!

6 Replies
Anonymous User
Anonymous User
Posted 1 year ago

Fit[] gives the linear fit and your data is non-linear and curvy. I must "perceive" data as {x,y} data for ListPlot - which would be a wild guess as for a computer trying to guess what you mean. If I have to guess then Alpha must do so as well.

 Plot[ Fit[ data[[All,2]], (1,x), x, {x,0,201} ]

Does plot the linear fit. You did not say if you want interpolation as a result, a best curve as a result, or a function with one or two variables as the result (a best function is not "simple" given a random set of dots unless a sum of Sin and Cos estimate it using a Mathematica built-in function, let's say).

I really can't see where your inquiry is leading. Is there some answer you expect?

POSTED BY: Anonymous User
Posted 1 year ago

Thanks for helping me!

Try, for example, fit {{1,1},{2,5},{3,9},{4,9},{5,13},{6,22}} in WolframAlpha


Now try fit {{0,1},{1,5},{2,9},{3,9},{4,13},{5,22},{6,23},{7,26},{8,27},{9,35},{10,41},{11,50},{12,69},{13,89},{14,113},{15,117},{16,134},{17,158},{18,177},{19,201},{20,231},{21,263},{22,295}}

It does not work. Exact same structure. One time, Wolfram|Alpha gave me a result, and then, it did not give me any results.

Posted 1 year ago

The free WolframAlpha service has always seemed to behave like there was an input line length limit. I have the superstition that it was limited to 80 characters years ago, but now it seems like that might have been expanded to 128 characters. If you can find a way to express your problem in that many characters or fewer, or you can find a way to divide your task into two simpler problems where the answers can be combined to solve your complete problem, then it can be used.

But it seems more complicated than this. For example, a few minutes ago this

122 character input

successfully found a fit.

Trying that again now, it won't find a fit and I have to repeatedly cut points off the end of that until I get down to this

80 character input

to successfully find a fit.

So perhaps in a similar way your 185 character input was successful once and now it can't find your fit.

Posted 1 year ago

Thanks! I do actually paid Pro suspecting that...and it is the same. Not sure how can I do that in pieces since it is fit of data...any way to upload data (just like we do with images) as a variable and then apply the fit? Thanks!

Posted 1 year ago

Since your data in your first post had your x coordinates starting at 1 and incrementing by 1 I tried providing only the y coordinates


which made the query substantially shorter

And it worked!

Even your longer more recent post, which starts at x=0 and increments, works


As always, I would study any result carefully and try to verify the correctness

Posted 1 year ago

It worked beautifully, Bill! Thanks! Those are the COVID cases in Costa Rica up to the 22nd day after the first case. Thanks again.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract