HP Forums
Gompertz curve - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Gompertz curve (/thread-3858.html)



Gompertz curve - salvomic - 05-15-2015 09:12 PM

hi all,
here there is a little program to get the Gompertz Curve (see here).
The idea was taken by the good tutorial by EddieW. Shore (thanks!).
I would like thanks also Han and Marcio (especially for his hints to fit a Gompertz curve).

Code:

EXPORT Gompertz_curve()
BEGIN
LOCAL cr, cg, cb, I;
LOCAL control:=1;

REPEAT
INPUT({A, B, C},
"Gompertz ae^(-be^(-ct))", {"asymptote A","displacement B","growth rate C" }, {"Asymptote", "Displacement along x", "Growth rate (y scaling)" }, {0,1,1},
{A, B, C});
CASE
IF (B <= 0) THEN MSGBOX ("B must be > 0"); control:=1; B:=1; END;
IF (C <= 0) THEN MSGBOX ("C must be > 0"); control:=1; C:=1; END;
DEFAULT control:=0;
END; // case
UNTIL control < 1;

// Colors
CHOOSE(I, "Choose a Color",
"Red", "Blue", "Orange", "Green");
cr := {255, 0, 255, 0};
cg := {0, 0, 127, 255};
cb := {0, 255, 0, 0};

STARTAPP("Advanced Graphing");
V1 := "Y=A*e^(-B*e^(-C*X))";
V1(COLOR) := RGB(cr(I), cg(I), cb(I));
CHECK(1);
// Plot View
STARTVIEW(1, 1);
END;