File: invalid4.py

package info (click to toggle)
pyx3 0.17-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,328 kB
  • sloc: python: 27,656; makefile: 225; ansic: 130; sh: 17
file content (27 lines) | stat: -rw-r--r-- 1,412 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
import sys;sys.path.insert(0, "..")
from math import *
from pyx import *
# File for invalid parametrisations of Bezier curves
# Check a-posteriori the sign of Delta y for the square-root solution of Delta x

def Dx_m(y):
    return (-1-2*y-sqrt((1+2*y)**2+3))/3.0
def Dx_p(y):
    return (-1-2*y+sqrt((1+2*y)**2+3))/3.0

con = {"Dx_m":Dx_m, "Dx_p":Dx_p}

g = graph.graphxy(width=10,
    x=graph.axis.lin(),
    y=graph.axis.lin(min=-2, max=2),
    key=graph.key.key(pos="bl"),
)
g.plot(graph.data.function("x(y)=6*y*Dx_m(y)", title="minus-sol, lhs", context=con), [graph.style.line([color.rgb.red])])
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])])
g.plot(graph.data.function("x(y)=6*y*Dx_p(y)", title="plus-sol, lhs", context=con), [graph.style.line([color.rgb.green])])
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])])
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])])
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])])
g.writePDFfile()