SMath Studio Forum
»
SMath Studio
»
Samples
»
Program for Linear and Polynomial Fit
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Simple examples on Linear and Polynomial fittings included as follows. This may be useful for beginners. 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 (739kb) downloaded 68 time(s).Edited by user 08 December 2019 13:18:33(UTC)
| Reason: Not specified |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
1 user thanked ndtma for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: ndtma Simple 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
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Originally Posted by: Jean Giraud SS 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 (684kb) downloaded 60 time(s).Edited by user 08 December 2019 18:52:18(UTC)
| Reason: Not specified |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
1 user thanked ndtma for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: ndtma Sorry 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 (16kb) downloaded 39 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Jean Giraud Reconstructed c/w a lot more elegant export J ... a bit more/different but encountered "puzzling or bug". Doctored but mystic. Polyfit Otherwise.sm (23kb) downloaded 26 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Jean Giraud ... 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 (18kb) downloaded 43 time(s).
|
2 users thanked Jean Giraud for this useful post.
|
on 09/12/2019(UTC), on 09/12/2019(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Hi. This is another approach. PolyFit.sm (19kb) downloaded 45 time(s). PolyFit.pdf (163kb) downloaded 49 time(s).Best regards. Alvaro
|
3 users thanked Razonar for this useful post.
|
on 09/12/2019(UTC), on 09/12/2019(UTC), on 09/12/2019(UTC)
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Razonar This is another approach. Thanks Alvaro ... superb ! Jean. That black regions is really a pen in the ass. PolyFit [Alvaro Balistic].sm (23kb) downloaded 27 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
... added HadCRU [Hadley Climate Research Unit] Global warming 1950 ... 2019 °C deviation wrt period 1950/1960 Fit on ChebyShev ± 1 and recovered on separate document. PolyFit [Alvaro Balistic].sm (134kb) downloaded 18 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Jean Giraud Fit 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 (311kb) downloaded 22 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Jean Giraud ... here is HadCRU fitted in the ChebyShev ± 1 ... the clean/refreshed Edu version. PolyFit [Alvaro Balistic].sm (231kb) downloaded 26 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Originally Posted by: ndtma Simple examples on Linear and Polynomial fittings included as follows. Another methodEdited by user 10 December 2019 19:19:47(UTC)
| Reason: Not specified |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: ndtma Simple examples on Linear and Polynomial fittings included as follows. ... tested/fails [Uncertainty] Poly 00 NDTMA.sm (113kb) downloaded 27 time(s).
|
1 user thanked Jean Giraud for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: Jean Giraud Originally Posted by: ndtma Simple examples on Linear and Polynomial fittings included as follows. ... tested/fails [Uncertainty] Poly 00 NDTMA.sm (113kb) downloaded 27 time(s). 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.
|
1 user thanked Razonar for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 14/10/2015(UTC) Posts: 308
Was thanked: 77 time(s) in 58 post(s)
|
|
1 user thanked CBG for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Thank 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. Once again Thank You all. |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Hi. R2 like ms excel added. And tome other alternatives for solve the matrix. PolyFit.sm (153kb) downloaded 31 time(s). PolyFit.pdf (694kb) downloaded 28 time(s).Best regards. Alvaro.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: ndtma Thank 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 (50kb) downloaded 22 time(s). Poly 000 jmG.sm (147kb) downloaded 23 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
That's my solution - to separate the functions from matrix building, - to use vectorize for speed
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: MarB That'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 (35kb) downloaded 42 time(s).
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Samples
»
Program for Linear and Polynomial Fit
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.