phystricks
Classes | Functions
phystricks.src.Constructors Namespace Reference

Classes

class  ObliqueProjection
 

Functions

def BoundingBox (P1=None, P2=None, xmin=1000, xmax=-1000, ymin=1000, ymax=-1000, parent=None, mother=None, math=False)
 
def Point (x, y)
 
def PolarPoint (r, theta)
 
def Segment (A, B=None, vector=None)
 
def PolarSegment (P, r, theta)
 
def AffineVector (A=None, B=None)
 
def Vector (A, B=None)
 
def Circle (center, radius, angleI=0, angleF=360, visual=False, pspict=None)
 
def CircleOA (O, A)
 
def CircleAB (A, B)
 
def CircularSector (center, radius, a, b)
 
def FractionPieDiagram (center, radius, a, b)
 
def Mark (graph=None, dist=None, angle=None, central_point=None, text="", mark_point=None, position=None, pspict=None)
 
def AngleAOB (A, O, B, r=None)
 
def Angle (A, O, B, r=None)
 
def phyFunction (fun, mx=None, Mx=None)
 
def ParametricCurve (f1, f2, interval=(None, None))
 
def NonAnalyticPointParametricCurve (f, mx, Mx)
 
def InterpolationCurve (points_list, context_object=None, mode=None)
 
def MeasureLength (seg, dist=0.1)
 
def CustomSurface (args)
 
def RightAngle (d1, d2, n1=0, n2=1, r=0.3)
 
def RightAngleAOB (A, O, B, n1=0, n2=1, r=0.3)
 
def PolarCurve (fr, ftheta=None)
 
def LagrangePolynomial (args)
 
def HermiteInterpolation (points_list)
 
def Polygon (args)
 
def Rectangle (args, arg)
 
def Circle3D (op, O, A, B, angleI=0, angleF=2 *pi)
 
def Vector3D (x, y, z)
 
def Cuboid (op, P, a, b, c)
 
def Grid (bb)
 
def Axes (C, bb, pspict=None)
 
def SingleAxe (C, base, mx, Mx, pspict=None)
 
def intervals (curve1, curve2, interval, interval1, interval2)
 
def SurfaceBetweenParametricCurves (curve1, curve2, interval=None, interval1=None, interval2=None, reverse1=False, reverse2=True)
 
def SurfaceUnderFunction (f, mx, Mx)
 
def SurfaceBetweenFunctions (f1, f2, mx=None, Mx=None)
 
def extract_interval_information (curve)
 
def SudokuGrid (question, length=1)
 
def phyMatrix (nlines, ncolumns)
 
def EllipseOAB (O, A, B)
 
def BarDiagram (X, Y)
 
def Histogram (tuple_box_list, legende=None)
 
def BoxDiagram (values, h, delta_y=0)
 
def Moustache (minimum, Q1, M, Q3, maximum, h, delta_y=0)
 
def ImplicitCurve (f, xrange, yrange, plot_points=100)
 
def Text (P, text, hide=True)
 
def VectorField (fx, fy, xvalues=None, yvalues=None, draw_points=None)
 

Function Documentation

def phystricks.src.Constructors.AffineVector (   A = None,
  B = None 
)
return an affine vector.

An affine vector is a vector whose origin is not specifically (0,0).

EXAMPLES:
    
An affine vector can be given by two points::

    sage: from phystricks import *
    sage: print AffineVector(Point(1,1),Point(pi,sqrt(2)))
    <vector I=<Point(1,1)> F=<Point(pi,sqrt(2))>>
def phystricks.src.Constructors.Angle (   A,
  O,
  B,
  r = None 
)
def phystricks.src.Constructors.AngleAOB (   A,
  O,
  B,
  r = None 
)
Return the angle AOB.

It represent the angle formed at the point O with the lines
OA and OB (in that order).

INPUT:

- ``A,O,A`` - points.

- ``r`` - (default, see below) the radius of the arc circle marking the angle.

OUTPUT:

An object ready to be drawn of type :class:`AngleGraph`.

If `r` is not given, a default value of 0.2 times the length OA is taken.

EXAMPLES:

Notice the difference between AOB and BOA::

    sage: from phystricks import *
    sage: A=Point(1,1)
    sage: O=Point(0,0)
    sage: B=Point(1,0)
    sage: print Angle(A,O,B).measure()
    AngleMeasure, degree=-45.0000000000000,radian=-1/4*pi
    sage: print Angle(B,O,A).measure()
    AngleMeasure, degree=45.0000000000000,radian=1/4*pi


.. literalinclude:: phystricksTriangleRectangle.py
.. image:: Picture_FIGLabelFigTriangleRectanglePICTTriangleRectangle-for_eps.png
def phystricks.src.Constructors.Axes (   C,
  bb,
  pspict = None 
)
Describe a system of axes (two axes).

By default they are orthogonal.
def phystricks.src.Constructors.BarDiagram (   X,
  Y 
)
def phystricks.src.Constructors.BoundingBox (   P1 = None,
  P2 = None,
  xmin = 1000,
  xmax = -1000,
  ymin = 1000,
  ymax = -1000,
  parent = None,
  mother = None,
  math = False 
)
def phystricks.src.Constructors.BoxDiagram (   values,
  h,
  delta_y = 0 
)
def phystricks.src.Constructors.Circle (   center,
  radius,
  angleI = 0,
  angleF = 360,
  visual = False,
  pspict = None 
)
Return a circle of given radius and center.

INPUT:

- ``center`` - the center of the circle.

- ``radius`` - the radius of the circle.

- ``angleI`` - (default=0) If you want an arc of circle, this is the beginning angle.
- ``angleF`` - (default=0) If you want an arc of circle, this is the ending angle.
- ``visual`` - (default=False) if 'True', the radius is taken as a 'visual' length. This option only affects the underlying parametric curve and then the graph. It is probably buggy to attempt to get normal and tangent vectors when a dilatation is performed when 'visual' is True.

OUTPUT:

A circle ready to be drawn

EXAMPLES:

The following describes the usual trigonometric circle::

        sage: from phystricks import *
        sage: circle=Circle(Point(0,0),1)
        sage: print circle.angleI
        AngleMeasure, degree=0.000000000000000,radian=0
        sage: print circle.angleF
        AngleMeasure, degree=360.000000000000,radian=0
def phystricks.src.Constructors.Circle3D (   op,
  O,
  A,
  B,
  angleI = 0,
  angleF = 2*pi 
)
def phystricks.src.Constructors.CircleAB (   A,
  B 
)
return a circle with diameter [AB]
def phystricks.src.Constructors.CircleOA (   O,
  A 
)
From the centrer O and a point A, return the circle.

INPUT:

- ``O`` - a point that will be the center of the circle.

- ``A`` - a point on the circle.

OUTPUT:

A circle ready to be drawn of type :class:`CircleGraph`.

EXAMPLES::

    sage: from phystricks import *
    sage: A=Point(2,1)
    sage: O=Point(0,0)
    sage: circle=CircleOA(O,A)
    sage: circle.radius
    sqrt(5)
def phystricks.src.Constructors.CircularSector (   center,
  radius,
  a,
  b 
)
def phystricks.src.Constructors.Cuboid (   op,
  P,
  a,
  b,
  c 
)
- `op` -- the projection method.
- `P` -- tuple (x,y) giving the lower left point
- `a,b,c` -- lengths of the edges.

      +--------------------------+
    0/ |                       1/|
    /  |         0             / |
    0-------------------------1  |
    |  |                      |  |
    |  |                     1|  | 
   3|  |______________________|__|
    |3/                       |2/
    |/           2            |/
    3-------------------------2
def phystricks.src.Constructors.CustomSurface (   args)
Represent the surface contained between some lines and (parametric) curves.

INPUT:
- ``*args`` - la tuple of lines like segments, functions, parametric curves.

EXAMPLE:
  
The following describes the surface between the circle of radius 1 and 
the square of length 1::

    sage: from phystricks import *
    sage: C=Circle(Point(0,0),1)
    sage: arc=C.parametric_curve(0,pi/2)
    sage: h=Segment(Point(0,1),Point(1,1))
    sage: v=Segment(Point(1,1),Point(1,0))
    sage: surf=CustomSurface(arc,h,v)

The border is not drawn.

This is somewhat the more general use of the pstricks's macro \pscustom
def phystricks.src.Constructors.EllipseOAB (   O,
  A,
  B 
)
An ellipse of center O and such that OA and OB are the axis 
(OA and OB are supposed to be orthogonal)
def phystricks.src.Constructors.extract_interval_information (   curve)
return the interval of the curve.

That is the initial and final value of the parameter
of `curve` if that is a :class:`ParametricCurve` and
the initial and final values of `x` if this the graph of a function.

INPUT:

- ``curve`` - graph of a function or a parametric curve

OUTPUT:

a tuple of numbers. If nothing is found, return (None,None).

EXAMPLES::

    sage: from phystricks import *
    sage: from phystricks.BasicGeometricObjects import *
    sage: f=phyFunction(x**2).graph(1,pi)
    sage: extract_interval_information(f)
    (1, pi)
     
    sage: from phystricks.BasicGeometricObjects import *
    sage: a=var('a')
    sage: curve=ParametricCurve(x,sin(x)).graph(sqrt(2),a)
    sage: extract_interval_information(curve)
    (sqrt(2), a)

    sage: f=phyFunction(x**3)
    sage: extract_interval_information(f)
    (None, None)
def phystricks.src.Constructors.FractionPieDiagram (   center,
  radius,
  a,
  b 
)
def phystricks.src.Constructors.Grid (   bb)
def phystricks.src.Constructors.HermiteInterpolation (   points_list)
return a polynomial that pass trough the given points with the given derivatives.

Each element of points_list is a triple
(x,y,d)
and the given polynomial satisfies P(x)=y and P'(x)=d

EXAMPLES :

sage : P=HermiteInterpolation( [  (1,14,7),(3,64,51),(-2,-16,31)    ] )
sage: P.simplify_full()
2*x^3 - x^2 + 3*x + 10
def phystricks.src.Constructors.Histogram (   tuple_box_list,
  legende = None 
)
An histogram is given by a list of tuple '(a,b,n)' where 'a' and 'b' are the extremal values of the box and 'n' is the number of elements in the box.
def phystricks.src.Constructors.ImplicitCurve (   f,
  xrange,
  yrange,
  plot_points = 100 
)
return the implicit curve given by equation f on the range xrange x yrange

This is a constructor for the class ImplicitCurveGraph
INPUT:

- ``f`` -- a function of two variables or equation in two variables

- ``xrange,yrange`` - the range on which we want to compute the implicit curve.

OPTIONAL INPUT:

- ``plot_points`` - (defautl : 100) the number of points that will be calculated in each direction. 

The resulting bounding box will not be in general xrange x yrange. 

EXAMPLES:

We know that the curve x^2+y^2=2 is a circle of radius sqrt(2). Thus even if you ask a range of size 5,  you will only get the bounding box of size sqrt(2).

EXAMPLES::

sage: from phystricks import *
sage: x,y=var('x,y')
sage: f(x,y)=x**2+y**2
sage: F=ImplicitCurve(f==2,(x,-5,5),(y,-5,5))
sage: print F.bounding_box()
<BoundingBox mx=-1.413,Mx=1.413; my=-1.413,My=1.413>

But the following will be empty::

sage: G=ImplicitCurve(f==2,(x,-1,1),(y,-1,1))
sage: print G.paths
[]

If you give very low value of plot_points, you get incorrect results::

sage: H=ImplicitCurve(f==2,(x,-2,2),(y,-2,2),plot_points=3)
sage: print H.bounding_box()
<BoundingBox mx=-1.414,Mx=1.414; my=-1.414,My=1.414>


Using Sage's implicit_curve and matplotlib, a list of points "contained" in the curve is created. The bounding_box is calculated from that list. The pstricsk code generated will be an interpolation curve passing trough all these points.
def phystricks.src.Constructors.InterpolationCurve (   points_list,
  context_object = None,
  mode = None 
)
determine an interpolation curve from a list of points.

INPUT:
- ``points_list`` - a list of points that have to be joined.

OPTIONAL INPUT:

- ``context_object`` -  the object that is going to use the InterpolationCurve's latex code.
                        ImplicitCurve and wavy curves are using InterpolationCurve as "backend" for the latex code.  Here we use the context_object in order to take this one into account when determining the parameters (color, ...).

EXAMPLES:

This example is valid, but will not plot the expected line (this is a feature of `\pscurve`)::

    sage: from phystricks import *
    sage: F=InterpolationCurve([Point(0,0),Point(1,1)])

If you want to plot the small segment, you have to add a point in the center::

    sage: F=InterpolationCurve([Point(0,0),Point(0.5,0.5),Point(1,1)])

The following draws a circle::

    sage: C=Circle(Point(0,0),1)
    sage: G=InterpolationCurve([C.get_point(2*pi/i,advised=False) for i in range(1,100)])

Notice in the lase example the use of advised=False in order to speed up the computation.

NOTE:

InterpolationCurve is used in order to produce implicit plot and wavy functions.
def phystricks.src.Constructors.intervals (   curve1,
  curve2,
  interval,
  interval1,
  interval2 
)
def phystricks.src.Constructors.LagrangePolynomial (   args)
return as `phyFunction` the Lagrange polynomial passing
trough the given points

You can either provide a list of points or some points.
def phystricks.src.Constructors.Mark (   graph = None,
  dist = None,
  angle = None,
  central_point = None,
  text = "",
  mark_point = None,
  position = None,
  pspict = None 
)
Describe a mark on a point.

The provided distance and angle are visual. That is
P.put_mark(0.3,45, ... )
will place a mark at distance 0.3 and angle 45 from the point P *on the picture*. This is why a pspicture is needed.

INPUT:

- ``graph`` - the graph that it marked. This is usually a point but it can be anything that has a `mark_point` method.
- ``dist`` - the distance between `graph.mark_point()` and the mark.
- ``angle`` - the angle given in degree or `AngleMeasure`.
- ``text`` - the text to be printed on the mark. This is typically a LaTeX stuff like "$P$".
- ``position`` - is one of "corner","N","S","W","E" or special cases (see below).

        - "corner" will put the mark at the distance such that the corner of the bounding box is at the (relative) position (dist;angle) instead of the center of the mark.
        - "N" will put the mark in such a way that the center of the north side of the bounding box is at the position (dist;angle).

        - "for axes". In this case we expect to have a 3-tuple `(pspict,"for axes",segment)` where `segment` is a segment (typically the segment of an axe).  In this case, we suppose `self.angle` to be orthogonal to the segment.  The mark will be put sufficiently far for the bounding box not to cross the segment.

     What is done is that the closest corner of the bounding box is at position (dist;angle) from the point.
- ``pspict`` - the pspict in which the mark has to be computed and drawn.
def phystricks.src.Constructors.MeasureLength (   seg,
  dist = 0.1 
)
When a segment exists, one wants sometimes to denote its length drawing a double-arrow parallel to the segment. This is what this class is intended to.

The segment (and then the graph associated with the mark) is the parallel one,
not the segment given in argument.

INPUT:

- ``seg`` - the segment to be measured.

- ``dist`` - the distance between the segment and the measure.

The sign of <dist> is an issue. If you give 0.3 you get one result, if you give
-0.3, you get the segment on the other side.
The algorithm is the following. If v is the vector seg.I --> seg.F and w is the vector from
<seg> to the arrow line to be drawn, then (v,w) has the same orientation as (Y,X) where X=(1,0) 
and Y=(0,1).
The rational is that if the segment is vertical, we want the measure to appear
on the right.

EXAMPLES:

.. literalinclude:: phystricksIntervalleUn.py
.. image:: Picture_FIGLabelFigIntervallePICTIntervalle-for_eps.png

In order to check the position of the arrow line,
we check the position of the mark_point::

    sage: from phystricks import *
    sage: O=Point(0,0)
    sage: A=Point(1,0)

Horizontal line directed from right to left; the
arrow line has to be bellow::

    sage: measureOA=MeasureLength(Segment(O,A),0.1)
    sage: print measureOA.mark_point()
    <Point(0.5,-0.100000000000000)>

Horizontal line directed from left to right::

    sage: measureAO=MeasureLength(Segment(A,O),0.1)
    sage: print measureAO.mark_point()
    <Point(0.5,0.100000000000000)>

Vertical line::

    sage: B=Point(0,2)
    sage: measureOB=MeasureLength(Segment(O,B),0.1)
    sage: print measureOB.mark_point()
    <Point(0.100000000000000,1.0)>

    

USEFUL ATTRIBUTE:

- ``self.advised_mark_angle`` - the angle at which we advise you to put the mark.
                                It indicates the direction orthogonal to the segment,
                                with the orientation given in the discussion about the
                                sign of <dist>.

::

    sage: m=MeasureLength(Segment( Point(1,1) ,Point(2,2) ),0.1)
    sage: print m.advised_mark_angle
    AngleMeasure, degree=315.000000000000,radian=7/4*pi

You are invited to use advised_mark_angle. If not the position of the mark
could be unpredictable.
def phystricks.src.Constructors.Moustache (   minimum,
  Q1,
  M,
  Q3,
  maximum,
  h,
  delta_y = 0 
)
Q1 and Q3 are first and third quartiles; M is the median.
h is the size of the box
def phystricks.src.Constructors.NonAnalyticPointParametricCurve (   f,
  mx,
  Mx 
)
Describe a parametric curve when we have a function 'f' that associates a Point from a value of the parameter.

- f : a function (in the Python sense) that takes a number as argument and which returns a PointGraph.
- mx,Mx  : the minimal and maximal values of the parameters.
def phystricks.src.Constructors.ParametricCurve (   f1,
  f2,
  interval = (None,None) 
)
Construct a parametric curve from its two Cartesian coordinates functions.

INPUT:

- ``f1,f2`` - functions that are the components of the parametric curve.
- 'interval' - the interval on which the curve is considered.

If 'f1' has mx and Mx and interval is not given, they are used.

OUTPUT:
an object ready to be drawn.

EXAMPLES::

    sage: from phystricks import *
    sage: x=var('x')
    sage: f1=phyFunction(x)
    sage: f2=phyFunction(x**2)
    sage: F=ParametricCurve(f1,f2).graph(-2,3)
    sage: G=ParametricCurve(f1,f2,mx=-2,Mx=3)

Notice that due to several `@lazy_attribute`, changing the components after creation could produce unattended results.

.. literalinclude:: phystricksCycloide.py

.. image:: Picture_FIGLabelFigCycloidePICTCycloide-for_eps.png
def phystricks.src.Constructors.phyFunction (   fun,
  mx = None,
  Mx = None 
)
Represent a function.

INPUT:

- ``fun`` - a function.
- ``mx,Mx`` - initial and final value of the argument.

EXAMPLES::

    sage: from phystricks import *
    sage: f=phyFunction(cos(x))
    sage: f(pi/2)
    0

    sage: g=phyFunction(2*f,0,pi)
    sage: g(pi)
    -2

    One can deal with probability distributions :
    sage: C=RealDistribution('chisquared',10).distribution_function
    sage: f=phyFunction(C)
    sage: f(4)
    0.0451117610789

EXAMPLES with function for which one don't know analytic form

.. literalinclude:: phystricksChiSquared.py
.. image:: Picture_FIGLabelFigChiSquaredPICTChiSquared-for_eps.png

OTHER EXAMPLE

.. literalinclude:: phystricksNonAnalyticOne.py
.. image:: Picture_FIGLabelFigNonAnalyticOnePICTNonAnalyticOne-for_eps.png
def phystricks.src.Constructors.phyMatrix (   nlines,
  ncolumns 
)
def phystricks.src.Constructors.Point (   x,
  y 
)
return a point.

INPUT:

- ``x,y`` - the coordinates of the point. These are numbers.


EXAMPLES::

    sage: from phystricks import *
    sage: print Point(1,1)
    <Point(1,1)>
    sage: print Point(pi,sqrt(2))
    <Point(pi,sqrt(2))>

You can pass variables::

    sage: x=var('x')
    sage: P=Point(x**2,1)   
    sage: print P
    <Point(x^2,1)>

Notice that the coordinates of the point have to be numerical in order to be passed to tikz (and then LaTeX) at the end::
def phystricks.src.Constructors.PolarCurve (   fr,
  ftheta = None 
)
return the parametric curve (:class:`ParametricCurve`) corresponding to the 
curve of equation r=f(theta) in polar coordinates.

If ftheta is not given, return the curve
x(t)=fr(t)cos(t)
y(t)=fr(t)sin(t)

If ftheta is given, return the curve
x(t)=fr(t)cos( ftheta(t) )
y(t)=fr(t)sin( ftheta(t) )

EXAMPLES::

.. literalinclude:: phystricksCardioid.py
.. image:: Picture_FIGLabelFigCardioidPICTCardioid-for_eps.png
def phystricks.src.Constructors.PolarPoint (   r,
  theta 
)
return the point at polar coordinates (r,theta).

INPUT:

- ``r`` - the distance from origine
- ``theta`` - the angle

EXAMPLES::

    sage: from phystricks import *
    sage: print PolarPoint(2,45)
    <Point(sqrt(2),sqrt(2))>
def phystricks.src.Constructors.PolarSegment (   P,
  r,
  theta 
)
return a segment on the base point P (class Point) of 
length r and angle theta (degree)
def phystricks.src.Constructors.Polygon (   args)
represent a polygon.

You can give either a list of point or a list containing the points :

.. literalinclude:: phystricksExPolygone.py
.. image:: Picture_FIGLabelFigExPolygonePICTExPolygone-for_eps.png
def phystricks.src.Constructors.Rectangle (   args,
  arg 
)
INPUT:

- ``NW,SE`` - the North-West corner and South-East corner

Alternatively, you can pass a bounding box as unique argument.

Still alternatively, you can pass xmin,ymin,xmax,ymax
def phystricks.src.Constructors.RightAngle (   d1,
  d2,
  n1 = 0,
  n2 = 1,
  r = 0.3 
)
'd1' and 'd2' are the two lines.
'r' is the size of the "edge"
'n1' and 'n2' are 0 ot 1 and are determining which of the 4 angles has to be marked (two lines -> 4 angles)
def phystricks.src.Constructors.RightAngleAOB (   A,
  O,
  B,
  n1 = 0,
  n2 = 1,
  r = 0.3 
)
return the right angle between Segment(A,O) and Segment(O,B)
def phystricks.src.Constructors.Segment (   A,
  B = None,
  vector = None 
)
Creates a segment.

The typical use is to give two points.
An alternative is to provide a point and a vector.
def phystricks.src.Constructors.SingleAxe (   C,
  base,
  mx,
  Mx,
  pspict = None 
)
Return an axe.

INPUT:

- ``C`` - the center of the axe. This is the point corresponding to the "zero" coordinate
- ``base`` - the unit of the axe. This indicates

            1. the direction
            2. the size of "1"

            A mark will be added at each integer multiple of that vector (but zero) including negative.
- ``mx`` - the multiple of ``base`` at which the axe begins. This is typically negative
- ``Mx`` -  the multiple of ``base`` at which the axe ends. This is typically positive
                The axe goes from ``C+mx*base`` to ``C-Mx*base``. 

OTHER CONTROLS :

The default behaviour can be modified by the following attributes.

- ``self.Dx`` - (default=1) A mark is written each multiple of ``self.Dx*base``.
- ``self.mark_angle`` - the angle in degree under which the mark are written. By default this is orthogonal
                    to the direction given by ``self.base``.

If an user-defined axes_unit is given, the length of ``base`` is "forgotten"

EXAMPLES::

    sage: from phystricks import *
    sage: axe = SingleAxe(Point(1,1),Vector(0,1),-2,2)
def phystricks.src.Constructors.SudokuGrid (   question,
  length = 1 
)
def phystricks.src.Constructors.SurfaceBetweenFunctions (   f1,
  f2,
  mx = None,
  Mx = None 
)
def phystricks.src.Constructors.SurfaceBetweenParametricCurves (   curve1,
  curve2,
  interval = None,
  interval1 = None,
  interval2 = None,
  reverse1 = False,
  reverse2 = True 
)
Represents a surface between two parametric curves.

'curve1' and 'curve2' are parametric curves or objects that have
a method 'parametric_curve'

    FOR THE INTERVALS :

    - interval=(pI,PF)    where pI and pF are the initial and final
    value of this parameter

    If you want to choose these parameters separately, use
    - interval1=(pI1,pF1),interval2=(pI2,pF2)

    You have to give either 'interval' or both 'interval1' and 'interval2'

    - If "interval" is given, it erases all other choices.
    - If neither 'interval' and 'interval1' are given,
    search in 'curve1' if there is something to eat.

OPTIONAL ARGUMENTS :

- ``reverse1`` - (default=False) if True, reverse the sense of curve1.

- ``reverse2`` - (default=True) if True, reverse the sense of curve1.

Let us suppose that curve1 goes from A1 to B1 and curve2 from A2 to B2
If we do not reverse the sense of anything, the result will be
the surface delimited by

curve1:        A1 -> B1
Fsegment:    B1 -> B2
curve2:        A2 -> B2
Isegment:   A2 -> A1
    
This is wrong since the last point of each line is not the first
point of the next line.

For that reason, the second curve is, by default, reversed in order to get
curve1:             A1 -> B1
Fsegment:         B1 -> B2
curve2 (reversed):  B2 -> A2
Isegment:        A2 -> A1

OUTPUT:
An object ready to be drawn.

EXAMPLES::

    sage: from phystricks import *
    sage: curve1=ParametricCurve(x,x**2).graph(2,3)
    sage: curve2=ParametricCurve(x,x**3).graph(2,5)
    sage: region=SurfaceBetweenParametricCurves(curve1,curve2)

The segment "closing" the domain are available by
the attributes `Isegment and Fsegment`::

    sage: print region.Isegment
    <segment I=<Point(2,8)> F=<Point(2,4)>>
    sage: print region.Fsegment
    <segment I=<Point(3,9)> F=<Point(5,125)>>

The initial and final values of the parameters can be given
in different ways.
The "normal" way is to provide the curves by triples `(curve,mx,Mx)`::

    sage: f1=phyFunction(x**2)
    sage: f2=phyFunction(x)
    sage: curve=SurfaceBetweenParametricCurves((f1,1,2),(f2,3,4))
    sage: print curve.mx1,curve.Mx1,curve.mx2,curve.Mx2
    1 2 3 4

If one of the curve is provided without interval, the latter will
be deduced::

    sage: f1=phyFunction(x**2).graph(1,2)
    sage: f2=phyFunction(x)
    sage: curve=SurfaceBetweenParametricCurves(f1,(f2,3,4))
    sage: print curve.mx1,curve.Mx1,curve.mx2,curve.Mx2
    1 2 3 4

If the optional argument `interval` is provided, it erases
the other intervals::

    sage: f1=phyFunction(x**2).graph(1,2)
    sage: f2=phyFunction(x)
    sage: curve=SurfaceBetweenParametricCurves(f1,(f2,3,4),interval=(7,8))
    sage: print curve.mx1,curve.Mx1,curve.mx2,curve.Mx2
    7 8 7 8

NOTE:
If the two curves make intersections, the result could be messy.

.. literalinclude:: phystricksBetweenParametric.py
.. image:: Picture_FIGLabelFigBetweenParametricPICTBetweenParametric-for_eps.png
def phystricks.src.Constructors.SurfaceUnderFunction (   f,
  mx,
  Mx 
)
Represent a surface under a function.

This is a particular case of SurfaceBetweenFunctions when
the second function is the y=0 axis.

The function `f` becomes `self.f1` while self.f2 will be the
function 0 (this is a consequence of inheritance).
The function f will also be recorded as self.f.

INPUT:

- ``f`` - a function
- ``mx,Mx`` - initial and final values 

EXAMPLES:

.. literalinclude:: phystricksSurfaceFunction.py
.. image:: Picture_FIGLabelFigSurfaceFunctionPICTSurfaceFunction-for_eps.png


.. literalinclude:: phystricksChiSquaresQuantile.py
.. image:: Picture_FIGLabelFigChiSquaresQuantilePICTChiSquaresQuantile-for_eps.png
def phystricks.src.Constructors.Text (   P,
  text,
  hide = True 
)
A text.

INPUT:

- ``P`` - the point at which the center of the bounding box will lie.

- ``text`` - the text.

- ``hide`` - (default=True) When `True`, the background of the text is hidden by
                a rectangle. The color and style of that rectangle can be customized,
                see :class:`BasicGeometricObjects.TextGraph`
def phystricks.src.Constructors.Vector (   A,
  B = None 
)
return a vector from (0,0) to the given point.

Vector(3,4)
Vector(P)  # If 'P' is a point
Vector(t)  # if 't' is a tuple of two numbers
def phystricks.src.Constructors.Vector3D (   x,
  y,
  z 
)
def phystricks.src.Constructors.VectorField (   fx,
  fy,
  xvalues = None,
  yvalues = None,
  draw_points = None 
)
return a vector field that is drawn on the points given in the list.

INPUT:

- ``fx,fy`` - two functions

OPTIONAL :

- ``xvalues`` - a tuple `(x,mx,Mx,n)` where `mx` and `Mx` are the min and max values of x and
                `n` is the number of values to be used on that interval.

- ``draw_points`` - a list of points on which the vector field has to be drawn.
                    If draw_point is given, xvalues and yvalues are not taken into account.

OUTPUT:
the graphe vector field.

EXAMPLES::

    sage: from phystricks import *
    sage: x,y=var('x,y')
    sage: F=VectorField(x*y,cos(x)+y)
    sage: F.divergence()
    (x, y) |--> y + 1


If you want an automatic Cartesian grid of points, use xvalues and yvalues::

    sage: F=VectorField(exp(x+y),x**2+y**2,xvalues=(x,-1,1,3),yvalues=(y,-5,5,6))
    sage: len(F.draw_points)
    18
    sage: print F.draw_points[5]
    <Point(-1.0,5.0)>

The same can be obtained using the following syntax (see the function GeometricVectorField.graph)::

    sage: F=VectorField(exp(x+y),x**2+y**2).graph(xvalues=(x,-1,1,3),yvalues=(y,-5,5,6))
    sage: len(F.draw_points)
    18
    sage: print F.draw_points[5]
    <Point(-1.0,5.0)>

If you want a personal list of points, use draw_points ::

    sage: F=VectorField(exp(x+y),x**2+y**2, draw_points=[Point(1,1),Point(5,-23)] )
    sage: print F.draw_points[0]
    <Point(1,1)>
    sage: print F.draw_points[1]
    <Point(5,-23)>

A vector field with automatic management of the points to be drawn:

.. literalinclude:: phystricksChampVecteursDeux.py
.. image:: Picture_FIGLabelFigChampVecteursDeuxPICTChampVecteursDeux-for_eps.png

A vector field with given points to be drawn: 

.. literalinclude:: phystricksChampVecteur.py
.. image:: Picture_FIGLabelFigChampVecteursPICTChampVecteurs-for_eps.png