#!/usr/local/bin/gnuplot -persist # set terminal canvas rounded size 600,400 enhanced fsize 10 lw 1.6 fontscale 1 name "bivariat_3" jsdir "." # set output 'bivariat.3.js' set key fixed right bottom vertical Right noreverse enhanced autotitle nobox set samples 50, 50 set style data lines set title "approximate the integral of functions (upper and lower limits)" set xrange [ * : * ] noreverse writeback set x2range [ * : * ] noreverse writeback set yrange [ * : * ] noreverse writeback set y2range [ * : * ] noreverse writeback set zrange [ * : * ] noreverse writeback set cbrange [ * : * ] noreverse writeback set rrange [ * : * ] noreverse writeback set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front noinvert bdefault integral_f(x) = (x>0)?int1a(x,x/ceil(x/delta)):-int1b(x,-x/ceil(-x/delta)) int1a(x,d) = (x<=d*.1) ? 0 : (int1a(x-d,d)+(f(x-d)+4*f(x-d*.5)+f(x))*d/6.) int1b(x,d) = (x>=-d*.1) ? 0 : (int1b(x+d,d)+(f(x+d)+4*f(x+d*.5)+f(x))*d/6.) f(x)=(x-2)**2-20 integral2_f(x,y) = (xy-d*.5) ? 0 : (int2(x+d,y,d) + (f(x)+4*f(x+d*.5)+f(x+d))*d/6.) delta = 0.2 plot [-10:10] f(x) title "f(x)=(x-2)**2-20", integral2_f(-5,x)