# HG changeset patch # User A.R. Burgers # Date 1614894133 -3600 # Thu Mar 04 22:42:13 2021 +0100 # Node ID 676db18cb83f00cedf03279ddeabca84821492a1 # Parent 88307452af1a9698dd2a3e5c84541d3043a6cc58 first step towards fixing b60113 * tricdf.m: fix diff -r 88307452af1a -r 676db18cb83f inst/tricdf.m --- a/inst/tricdf.m Mon Mar 01 19:53:49 2021 +0100 +++ b/inst/tricdf.m Thu Mar 04 22:42:13 2021 +0100 @@ -63,7 +63,7 @@ cdf(k_temp) += full_area; k_temp = k & (a < x) & (x < c); - area = (x(k_temp) - a).^2 * h; + area = (x(k_temp) - a).^2 * h / (2 * ( c - a)); cdf(k_temp) += area; k_temp = k & (b <= x); @@ -71,7 +71,7 @@ cdf(k_temp) += full_area; k_temp = k & (c < x) & (x < b); - area = (b-x(k_temp)).^2 * h; + area = (b-x(k_temp)).^2 * h / (2 * (b - c)); cdf(k_temp) += full_area - area; else h = 2 ./ (b-a); @@ -81,7 +81,7 @@ cdf(k_temp) += full_area; k_temp = k & (a <= x) & (x < c); - area = (x(k_temp) - a(k_temp)).^2 .* h(k_temp); + area = (x(k_temp) - a(k_temp)).^2 .* h(k_temp) ./ (2 * (c(k_temp) - a(k_temp))); cdf(k_temp) += area; k_temp = k & (b <= x); @@ -89,7 +89,7 @@ cdf(k_temp) += full_area; k_temp = k & (c <= x) & (x < b); - area = (b(k_temp)-x(k_temp)).^2 .* h(k_temp); + area = (b(k_temp)-x(k_temp)).^2 .* h(k_temp) ./ (2 * (b(k_temp) - c(k_temp))); cdf(k_temp) += full_area - area; endif # HG changeset patch # User A.R. Burgers # Date 1614970473 -3600 # Fri Mar 05 19:54:33 2021 +0100 # Node ID 739a37a5827c3ef881061c445b98e91f1f875f09 # Parent 676db18cb83f00cedf03279ddeabca84821492a1 fix bug in triinv calculation report in bug 60113 diff -r 676db18cb83f -r 739a37a5827c inst/triinv.m --- a/inst/triinv.m Thu Mar 04 22:42:13 2021 +0100 +++ b/inst/triinv.m Fri Mar 05 19:54:33 2021 +0100 @@ -58,11 +58,11 @@ w = c-a; area1 = h * w / 2; j = k & (x <= area1); - inv(j) += (x(j) * (h/2) * w).^0.5 + a; + inv(j) += (x(j) * 2 * w / h).^0.5 + a; w = b-c; j = k & (area1 < x) & (x < 1); - inv(j) += b - ((1-x(j)) * (h/2) * w).^0.5; + inv(j) += b - ((1-x(j)) * 2 * w / h).^0.5; j = k & (x == 1); inv(j) = b; @@ -71,11 +71,11 @@ w = c-a; area1 = h .* w / 2; j = k & (x <= area1); - inv(j) += (x(j) .* (h(j)/2) .* w(j)).^0.5 + a(j); + inv(j) += (2 * x(j) .* (w(j) ./ h(j))).^0.5 + a(j); w = b-c; j = k & (area1 < x) & (x < 1); - inv(j) += b(j) - ((1-x(j)) .* (h(j)/2) .* w(j)).^0.5; + inv(j) += b(j) - (2 * (1-x(j)) .* (w(j) ./ h(j))).^0.5; j = k & (x == 1); inv(j) = b(j);