2 import sys
;sys
.path
.insert(0, "..")
5 # File for invalid parametrisations of Bezier curves
6 # Draws a sketch of the areas where invalid params are to be expected
10 return -3*y
*(-x
+ abs(x
))
12 return -3*y
*(-x
- abs(x
))
16 return (1-3*x
) * (1-y
+ sqrt(1+y
+y
*y
))
18 return (1-3*x
) * (1-y
- sqrt(1+y
+y
*y
))
31 val
= min(val
, abs(lhs(x
,y
,sign1
) - rhs(x
,y
,sign2
)))
34 xmin
, xmax
, xn
= -2, 3, 250
35 xvalues
= [xmin
+ (xmax
-xmin
)*i
/(xn
-1) for i
in range(xn
)]
36 ymin
, ymax
, yn
= -3, 2, 250
37 yvalues
= [ymin
+ (ymax
-ymin
)*i
/(yn
-1) for i
in range(yn
)]
42 d
.append((x
, y
, log(f(x
, y
))))
44 g
= graph
.graphxy(width
=10,
45 x
=graph
.axis
.lin(title
=r
"$\Delta x$", min=xmin
, max=xmax
),
46 y
=graph
.axis
.lin(title
=r
"$\Delta y$", min=ymin
, max=ymax
),
48 g
.plot(graph
.data
.points(d
, x
=1, y
=2, color
=3, title
=None),
49 [graph
.style
.density(gradient
=color
.rgbgradient
.Rainbow
)])
51 g
.plot(graph
.data
.function("x(y)=(-1-2*y-sqrt((1+2*y)**2+3))/3.0"), [graph
.style
.line([style
.linestyle
.dotted
])])
52 g
.plot(graph
.data
.function("x(y)=(-1-2*y+sqrt((1+2*y)**2+3))/3.0", max=-1), [graph
.style
.line([style
.linestyle
.dotted
])])