# set terminal canvas  rounded size 600,400 enhanced fsize 10 lw 1.6 fontscale 1 name "piecewise_2" jsdir "."
# set output 'piecewise.2.js'
set format x "%.1f" 
set format y "%.1f" 
set format x2 "%.1f" 
set format y2 "%.1f" 
set format z "%.1f" 
set format cb "%.1f" 
set format r "%.1f" 
set key fixed left top vertical Left reverse enhanced autotitle nobox
set key invert samplen 4 spacing 1 width 0 height 0 
set label 1 "plot norm(x),  [0:1] part1(x),  [1:4] part2(x)" at 1.00000, 0.620000, 0.00000 left norotate back nopoint
set arrow 1 from 1.00000, 0.700000, 0.00000 to 1.00000, 0.900000, 0.00000 nohead back nofilled linewidth 1.000 dashtype solid
set style line 1  lt 0 linewidth 3.000 dashtype solid pointtype 0 pointsize default pointinterval 0
set style line 2  lt 0 linewidth 3.000 dashtype solid pointtype 0 pointsize default pointinterval 0
set style data lines
set xtics border in scale 1,0.5 nomirror norotate  autojustify
set title "Piecewise approximation to the\nNormal Cumulative Distribution Function" 
set xrange [ 0.00000 : 4.00000 ] noreverse nowriteback
set yrange [ 0.500000 : 1.10000 ] noreverse nowriteback
part1(x) = 0.5 + (9.*x-x**3)/ 24.
part2(x) = 1.0 + (x-3.0)**3 / 48.
save_encoding = "utf8"
GPFUN_part1 = "part1(x) = 0.5 + (9.*x-x**3)/ 24."
GPFUN_part2 = "part2(x) = 1.0 + (x-3.0)**3 / 48."
part1 = "part1: for x < 1  norm(x) ≈  ½ + (9x-x^3) / 24"
part2 = "part2: for x > 1  norm(x) ≈   1 +  (x-3)^3 / 48"
plot norm(x) lt -1,      [1:4] part2(x) ls 2 title part2,      [0:1] part1(x) ls 1 title part1