Curve fit function?

Curve fit function? - Looking to do a pump curve fit - Messages

#1 Posted: 4/19/2016 12:33:08 PM
Ruben Sidranski

Ruben Sidranski

17 likes in 463 posts.

Group: User

Could not find an example short of an article by Urroz in 2010 File not found.. He discusses a "LinearDataFit.sm" snippet that I could not find as a download. This sheet File not found. is based off of the data in that PDF file. In Mathcad, I would type "linfit(x,y,F)="
Is there an equivalent?
#2 Posted: 4/19/2016 2:02:33 PM
CBG

CBG

77 likes in 312 posts.

Group: User

Hi,

Use this example QuadFit.sm (13 KiB) downloaded 236 time(s).

It was taken from here :http://people.stfx.ca/bliengme/SMath/


Regards



Add *.sm file of Pump Curve fit: Pump_Fitting_Curve_Example_a.sm (26 KiB) downloaded 105 time(s).
1 users liked this post
ElSid 4/19/2016 2:10:00 PM
#3 Posted: 4/19/2016 4:25:10 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Use this example QuadFit.sm (44 KiB) downloaded 64 time(s).

1 users liked this post
Davide Carpi 4/19/2016 7:40:00 PM
#4 Posted: 4/19/2016 5:13:54 PM
Ruben Sidranski

Ruben Sidranski

17 likes in 463 posts.

Group: User

CBG's format worked great for me (Thank you). I was going through my MathCAD sheets/notes ...Curve.PNG

Jean, for the first time, your algo gave me an error.Plot.PNG
#5 Posted: 4/19/2016 6:12:16 PM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

Just one character fixes Jean's excellent (as usual) sample:

QuadFit (1).sm (40 KiB) downloaded 131 time(s).
С уважением, Михаил Каганский
1 users liked this post
Davide Carpi 4/19/2016 7:40:00 PM
#6 Posted: 4/19/2016 6:38:54 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

"CBG's format worked great for me (Thank you). I was going through my MathCAD sheets/notes ..."

The question is not if CBG works or not in your installation. The problem is
why my work sheet is not compatible to your version. You say it does not work.
Read the error message "Not set to an instance to compute" . So, how many of
the user created function your version won't read ? W/o user programmed functions,
Smath is just a curiosity.


"How simple" from your Mathcad !!! plot and see .
I have same result from OriginLab than Smath. OriginLab was doing gorgeous
fitting much before Mathcad 8/11 , Why? because fitting techniques were developped
between Mathsoft Collabs [especially: Robert, Paul, Jean ...].


"Jean, for the first time, your algo gave me an error".
Yes because your Smath version is not set to read backward version [to be confirmed].

"On a side note, on the picture (very bottom), you define "Poly" at the top of the next graph.
I am olmy familiar with poly and data being on the bottom like the top most picture".

"Poly" is any name to assign the result of the discrete algo.

Cheers, Jean
#7 Posted: 4/19/2016 7:08:27 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Your Mathcad coding is pure invention. It can't be otherwise than
it was Mathcad 8/11. Where does that big blue note comes from ?

Jean

Forum Quadratic Proof.gif

#8 Posted: 4/19/2016 7:17:45 PM
Ruben Sidranski

Ruben Sidranski

17 likes in 463 posts.

Group: User

Jean,
Your coding is phenomenal. Thank you again. Mike found the "character" that was off. I will look for the whole Mathcad sheet and post. I have snippets all over the place and I promised myself to try and be more organized. Not @ computer, but I think in poly:=, the function needed to be f(_x). I took a quick look see but I did not study
1 users liked this post
Davide Carpi 4/19/2016 7:21:00 PM
#9 Posted: 4/19/2016 7:22:53 PM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Wrote

in poly:=, the function needed to be f(_x)



Thank you for pointing out where was the issue (and Jean for the code and Mike for the debug too)

In fact is not a problem of SS version, I opened the file attached by Jean with 0.97.5346 and I got the same error.

2016-04-20 00_26_34-SMath Studio Desktop - [QuadFit.sm_].png

Still, I see the screenshot of Jean and I don't understand how it is possible that worked for him.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#10 Posted: 4/19/2016 7:33:59 PM
CBG

CBG

77 likes in 312 posts.

Group: User

ElSid:

What is the purpose you are looking for adjusting flow ​​against head?

Find a value for a Head with a flow not specified in the flow vector ? , Is it to interpolate ?
If it is to interpolate , the easiest thing is to use directly the function " ainterp (V1 , V2, V3 ) "


A very simple example: Example_Ainterp.sm (6 KiB) downloaded 64 time(s).

Best Regards
#11 Posted: 4/19/2016 7:53:38 PM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

Wrote

Still, I see the screenshot of Jean and I don't understand how it is possible that worked for him.


I'm not sure he had x defined above the screenshoted region at the time of screenshoting
С уважением, Михаил Каганский
1 users liked this post
Davide Carpi 4/19/2016 7:57:00 PM
#12 Posted: 4/19/2016 8:00:10 PM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Wrote

I'm not sure he had x defined above the screenshoted region at the time of screenshoting


Good point (it may happens with auto calculation disabled). I think he have to download and evaluate his own attached worksheet and confirm if is still working or not.

If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#13 Posted: 4/19/2016 10:08:59 PM
Ruben Sidranski

Ruben Sidranski

17 likes in 463 posts.

Group: User

Wrote

Just one character fixes Jean's excellent (as usual) sample


I am look at the fixed file from Mike and comparing it to Jean's original file. The only difference I see between them is the underscore in the function f(_x) in the Poly definition. Totally lost with the
  1. Why the underscore made it work?
  2. What the recasting of the scalar does?
See screenshot green items.Difference.PNG
#14 Posted: 4/19/2016 11:11:19 PM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

Wrote

I am look at the fixed file from Mike and comparing it to Jean's original file. The only difference I see between them is the underscore in the function f(_x) in the Poly definition.


Yes, that's exactly that one character I mentioned above
Quote

  • Why the underscore made it work?


  • Because the "_x" is undefined. Jean used function-as-parameter feature to pass an algo to a function. SMath requires that in this case, the passed function (here it's f(#)) must have its fictive parameters all previously undefined variables. This is very old requirement (I'm unsure if there ever existed a version without it). As Jean has defined "x" above, it coudn't be used as fictive parameter to passed f().

    Edit: wrong English error message is reported as SS-2324.
    С уважением, Михаил Каганский
    #15 Posted: 4/19/2016 11:40:33 PM
    Jean Giraud

    Jean Giraud

    983 likes in 6866 posts.

    Group: User

    Hello Collabs ,

    Here is the screen shot of the attached work sheet.
    My installed Smath 5346 is "as is" from the day it was installed.
    No download update. Why the underscore would make it work on Elsid
    version, can't explain. From what you are saying Davide, it looks
    that if some of the "nightly build" reside in the same machine, it
    broke logical link to user define function, or code incompatibility
    between versions.

    Jean

    Forum Quadratic Proof 5346.gif



    Poly Quadratic 5346.sm (38 KiB) downloaded 62 time(s).
    #16 Posted: 4/19/2016 11:50:43 PM
    Mike Kaganski

    Mike Kaganski

    184 likes in 434 posts.

    Group: User

    This topic discusses the functions-as-parameter thing. You may notice, that it's 6 years old (started 24 Jun 2010), much older than 0.97.5346 (21 August 2014). And yet, all requirements, including requirement that all variables must be previously undefined, are already in place.

    And yes, as expected, Jean's last file opens fine, because it doesn't contain global definitions of x.
    С уважением, Михаил Каганский
    #17 Posted: 4/20/2016 10:26:06 AM
    Ruben Sidranski

    Ruben Sidranski

    17 likes in 463 posts.

    Group: User

    Mike,
    Thanks for the explanation
    Wrote

    1. ANSWERED
      Wrote

    2. What the recasting of the scalar does?

    The screen shot I posted shows it equals nothing ... Multiplying the vectors with the second one being a vector within a vector does not compute in my brain
    Wrote

    Your Mathcad coding is pure invention. It can't be otherwise than it was Mathcad 8/11. Where does that big blue note comes from ?

    Jean, The Mathcad file I posted in blue does NOT use the same data points, so the polynomial coefficients "b" will be different. I was trying to copy the syntax over to SMath
    Wrote

    What is the purpose you are looking for adjusting flow ​​against head?

    Great question. I will post the actual files for a project that describe what I am trying to model as soon as I get a copy of the files from the vendors archive (I cannot find my copies). Essentially, it is a VFD driven pump in a wet well, with a min/max elevation drawdown (range) as the wet well goes up and down so looking at min/max. I want to identify the "trapezoid" that the pump must operate in using the "hatching" code in
    Wrote

    Reservoir Flood Capacity Estimation.sm (188 KiB) downloaded 130 time(s).

    The vendors typically give a "few" data points (some as little as 3). So tying it into one sheet would be phenomenal. Easy to do on paper ...
    I want to use the affinity rules to go from here.
    #18 Posted: 4/20/2016 11:51:10 AM
    Martin Kraska

    Martin Kraska

    1222 likes in 2150 posts.

    Group: Moderator

    The Maxima plugin provides the function Fit(), see the interactive handbook for details.

    File not found.File not found.
    Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
    1 users liked this post
    Davide Carpi 4/20/2016 12:35:00 PM
    #19 Posted: 4/20/2016 12:57:30 PM
    Jean Giraud

    Jean Giraud

    983 likes in 6866 posts.

    Group: User

    Hello Martin,

    Very interesting, but does not work in 5346.
    Your work sheet does not work either.

    Jean

    Forum Maxima Forcibly closed.gif
    #20 Posted: 4/20/2016 1:50:13 PM
    Jean Giraud

    Jean Giraud

    983 likes in 6866 posts.

    Group: User

    Wrote

    Essentially, it is a VFD driven pump in a wet well, with a min/max elevation drawdown (range) as the wet well goes up and down so looking at min/max.I want to identify the "trapezoid" that the pump must operate in using the "hatching" code in



    In 1970 I was working in the mning industries and that problem of min/max didn't exist.
    All our 100's pump box had a little inexpensise level contol. w/o a diagram of what
    you are attempting, hard to visualise. I don't see the relationship with the "Flood"
    work sheet , maybe I'm wrong ? Too many bits and pieces in there.

    Jean

    • New Posts New Posts
    • No New Posts No New Posts