diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/epix/samples/weierstrass.xp |
Initial commit
Diffstat (limited to 'graphics/epix/samples/weierstrass.xp')
-rw-r--r-- | graphics/epix/samples/weierstrass.xp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/graphics/epix/samples/weierstrass.xp b/graphics/epix/samples/weierstrass.xp new file mode 100644 index 0000000000..2822b0737a --- /dev/null +++ b/graphics/epix/samples/weierstrass.xp @@ -0,0 +1,36 @@ +/* -*-ePiX-*- */ +#include "epix.h" +using namespace ePiX; + +const int N(8); // Number of summands + +double weierstrass(double t) +{ + double y(0); + for(int i=0; i < N; ++i) + y += pow(2,-i)*cb(pow(2,i)*t); + + return y; +} + +int main() +{ + picture(P(-2, 0), P(2, 1.5), "3.2 x 1.2in"); + + begin(); + + h_axis(2*xsize()); + v_axis(2*ysize()); + h_axis_labels(xsize(), P(-4,-8)); + + blue(); + plot(cb, xmin() - 0.25, xmax()+0.25, 4*xsize() + 2); + + bold(Black()); + plot(weierstrass, xmin(), xmax(), pow(2,N)); + + pen(Red()); + plot(weierstrass, 0.5, 1.5, pow(2,N-2)); + + end(); +} |