fix defaults for x any y (to be strings)
[PyX.git] / design / invalid4.py
blob36a650c44cbea56898ddc8b10587f420af586fbd
1 #!/usr/bin/env python
2 import sys;sys.path.insert(0, "..")
3 from math import *
4 from pyx import *
5 # File for invalid parametrisations of Bezier curves
6 # Check a-posteriori the sign of Delta y for the square-root solution of Delta x
8 def Dx_m(y):
9 return (-1-2*y-sqrt((1+2*y)**2+3))/3.0
10 def Dx_p(y):
11 return (-1-2*y+sqrt((1+2*y)**2+3))/3.0
13 con = {"Dx_m":Dx_m, "Dx_p":Dx_p}
15 g = graph.graphxy(width=10,
16 x=graph.axis.lin(),
17 y=graph.axis.lin(min=-2, max=2),
18 key=graph.key.key(pos="bl"),
20 g.plot(graph.data.function("x(y)=6*y*Dx_m(y)", title="minus-sol, lhs", context=con), [graph.style.line([color.rgb.red])])
21 g.plot(graph.data.function("x(y)=(1-3*Dx_m(y))*(1-y-sqrt(1+y+y*y))", title="minus-sol, minus-rhs", context=con), [graph.style.line([color.rgb.blue, style.linestyle.dashed])])
22 g.plot(graph.data.function("x(y)=6*y*Dx_p(y)", title="plus-sol, lhs", context=con), [graph.style.line([color.rgb.green])])
23 g.plot(graph.data.function("x(y)=(1-3*Dx_p(y))*(1-y+sqrt(1+y+y*y))", title="plus-sol, plus-rhs", context=con), [graph.style.line([style.linestyle.dashed])])
24 g.plot(graph.data.function("x(y)=(1-3*Dx_p(y))*(1-y-sqrt(1+y+y*y))", title="plus-sol, minus-rhs", context=con), [graph.style.line([style.linestyle.dotted])])
25 g.plot(graph.data.function("x(y)=(1-3*Dx_m(y))*(1-y+sqrt(1+y+y*y))", title="minus-sol, plus-rhs", context=con), [graph.style.line([style.linestyle.dotted])])
26 g.writePDFfile()