Program for Linear and Polynomial Fit - Poruke
Examples 1 to 3 are for comparison only. Plot of given data is necessary to guess the distribution.
1. Ex. 1: Quadratic, posted by Martin
2. Ex.2: Ex.1 using SMath
3. Ex.3. Linear
4. Ex.4: A simple program to determine a suitable Linear / Polynomial fit to such data.
1.0 Linear & Poly Fits.sm (738,92 KiB) preuzeto 1396 put(ova).

WroteSimple examples on Linear and Polynomial fittings included as follows.
SS 6179 does not open at all and may have crashed my session.
If SS 7251 syntax is not compatible, it just turns red.
As it looks, incompatible syntax in program is dead like a stone.
Voltaire declared [not exactly] ...
When a stone is dead, she is dead for a long time !
Why not simply open the red syntax program ?
The black regions SS 7251 have been reported many times,
still pending Doctors to come back from fishing.
Thanks Collab NDTMA
WroteSS 6179 does not open at all and may have crashed my session.
Sorry Jean. Forgot to attach the PDF. Thanks for your observations.
1.0 Linear & Poly Fits.pdf (683,54 KiB) preuzeto 1020 put(ova).
WroteSorry Jean. Forgot to attach the PDF. Thanks for your observations.
Thanks for the *.PDF
Reconstructed c/w a lot more elegant export
Jean.
Polyfit Otherwise.sm (15,6 KiB) preuzeto 1327 put(ova).
WroteReconstructed c/w a lot more elegant export
J
... a bit more/different but encountered "puzzling or bug".
Doctored but mystic.
Polyfit Otherwise.sm (22,44 KiB) preuzeto 1263 put(ova).
Wrote... a bit more/different but encountered "puzzling or bug".
Doctored but mystic.
... suite/reconciliation from SS 5346 [works SS 6179]
Elegant and profitable, no bug/puzzling. Export polyfit.
Polynomial fit Methods [Regress Quick].sm (17,83 KiB) preuzeto 1173 put(ova).
PolyFit.sm (18,44 KiB) preuzeto 1337 put(ova).
PolyFit.pdf (162,98 KiB) preuzeto 897 put(ova).
Best regards.
Alvaro
WroteThis is another approach.
Thanks Alvaro ... superb ! Jean.
That black regions is really a pen in the ass.
PolyFit [Alvaro Balistic].sm (22,1 KiB) preuzeto 1187 put(ova).
Global warming 1950 ... 2019 °C deviation wrt period 1950/1960
Fit on ChebyShev ± 1 and recovered on separate document.
PolyFit [Alvaro Balistic].sm (133,63 KiB) preuzeto 1087 put(ova).
WroteFit on ChebyShev ± 1 and recovered on separate document.
... here is HadCRU fitted in the ChebyShev ± 1
then recovered in the original 1950 ... 2019 range.
It has nothing to do with the PolyFit(X,Y,n)
simply that high order polynomials are numerically
unstable at high range of the variate 'x'.
It has nothing to do with the CAS or floating arithmetic,
simply an Edu mathematical fact.
PolyFit [Alvaro Balistic].sm (310,61 KiB) preuzeto 1097 put(ova).
Wrote... here is HadCRU fitted in the ChebyShev ± 1
... the clean/refreshed Edu version.
PolyFit [Alvaro Balistic].sm (230,72 KiB) preuzeto 1138 put(ova).
WroteSimple examples on Linear and Polynomial fittings included as follows.
... tested/fails [Uncertainty]
Poly 00 NDTMA.sm (112,87 KiB) preuzeto 1346 put(ova).
WroteWroteSimple examples on Linear and Polynomial fittings included as follows.
... tested/fails [Uncertainty]
Poly 00 NDTMA.sm (112,87 KiB) preuzeto 1346 put(ova).
Hi. Here

the code (el(x,r)≡0)&(c≡1) for construct the Vandermonde matrix is for avoid 0^0, which returns the error.
Also, I avoid augment in the recursive loops because it's frustratingly slow.
Finlay, the code for PolyVal it's very inefficient, it's only for pedagogical purposes. Horner must be implemented for some other application. Notice that both are matlab/octave/scilab routines too.
In my opinion, the intention of Nugegodage to replicate ms excel results in SMath is very important, to promote SMaths as better alternative to excel doing math.
Best regards.
Alvaro.

Cholesky_Function_CBG_Jean_SS7251.sm (168,3 KiB) preuzeto 1369 put(ova).
Cholesky_Function_CBG_Jean_SS6179.sm (166,42 KiB) preuzeto 1336 put(ova).
Best Regards
Carlos
BTW, I too get "uncertainty" error in Jean's example. Hope these issues will be resolved soon.
Once again Thank You all.
PolyFit.sm (152,04 KiB) preuzeto 1324 put(ova).
PolyFit.pdf (693,6 KiB) preuzeto 868 put(ova).
Best regards.
Alvaro.
WroteThank you Jean, Alvaro and Carlos for your valuable responses.
BTW, I too get "uncertainty" error in Jean's example. Hope these issues will be resolved soon.
Resolved in the attached from coding Cholesky the right way.
Alvaro code was OK too.
All in all, purely polynomials have so few applications
that they don't worth more than a short Classroom introduction.
On the other hand, the vector of functions is lot more productive.
And BTW, it is the form for the Conjugate Gradient model fitting.
Jean.
Poly 000 jmG Conjugate Gradient.sm (49,54 KiB) preuzeto 1302 put(ova).
Poly 000 jmG.sm (146,39 KiB) preuzeto 1310 put(ova).
WroteThat's my solution
- to separate the functions from matrix building,
- to use vectorize for speed
Thanks for your effort/contribution.
Sorry, but too much of a monkey business.
Here are the two elegant Cholesky linear solver:
1. The modular local utility [Mathcad linfit style]
2. The general algo style as an Smath native.
Works same SS 6179 from original created SS 5346.
Hope this document will tranquilize visitors/users !
Jean.
Poly 000 jmG linfit MCD.sm (34,52 KiB) preuzeto 1344 put(ova).
- Novi postovi
- Nema novih postova

