HP PPL and Statistical distributions
|
05-18-2021, 11:15 PM
(This post was last modified: 05-25-2021 12:24 PM by Albert Chan.)
Post: #9
|
|||
|
|||
RE: HP PPL and Statistical distributions
Hi, robmio
Here is the translated quad, in PPL. I hope this is right, as I am learning PPL as I code. Compare to Lua or Python, there are some gothas: 1. all local variables have to declare up front. 2. there is no Lua elseif or Python elif equivalent. 3. there is no logic precedence: a OR b AND c translated to ((a OR b) AND c) 4. comparison operators has "sugar" in it, which may translated wrongly. Cas> a > b > c → a > b AND b > c ... looks good Cas> a > b > c > d → ((a>b) AND (b>c)) > d ??? Cas> (a>b) == (mode == 2) → a>b and b == mode == 2 ??? Code: #cas Usage: Cas> pdf(x) := exp(-x*x/2) / sqrt(2*pi) Cas> quad(pdf, -1, 1) → [0.682689492137, 2.08159857137e−14] Cas> quad(pdf, 1, inf) → [0.158655253928, 1.81990772641e−10] Cas> quad(pdf, 1, -inf) → [-0.841344746, 7.74963867073e−11] Cas> quad(pdf, -inf, 1) → [ 0.841344746, 7.74963867073e−11] Cas> quad(pdf, -inf, inf) → [1., 8.45545855554e−13] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)