Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/extras/Zcos.m4

raw
1 .PS
2 # Zcos.m4
3 gen_init
4 NeedDpicTools
5
6 # define f1 { ee = expe(8*x*`$1'*(x^2 - (`$1')^2));
7 # $2 = ee + 1/ee + 2*cos(2*x^4 + 2*(`$1')^4 - 12*x^2*(`$1')^2) - 4;
8 # }
9
10 # alternative: |cos(z^4)| = 1
11 define f1 { Z: (x,$1)
12 Z4: Zprod(Zprod(Z,Z),Zprod(Z,Z))
13 $2 = zabs(Zcos(Z4)) - 1
14 }
15
16 ni = 200
17 for i=10 to ni do { x = i/ni*3
18 findroot( f1, 0, 0.2, 1e-8, y )
19 P[i-10]: x,y }
20 np = ni-10
21
22 for deg=0 to 359 by 45 do {
23 for i=0 to np do { Z[i]: rot_(P[i].x,P[i].y,deg*dtor_) }
24 fitcurve(Z,np,thick 2 outlined "blue")
25 for i=0 to np do { Z[i]: rot_(P[i].x,-P[i].y,deg*dtor_) }
26 fitcurve(Z,np,thick 2 outlined "blue")
27 }
28
29 .PE