phystricks
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
phystricks.src.ParametricCurveGraph.ParametricCurveGraph Class Reference
Inheritance diagram for phystricks.src.ParametricCurveGraph.ParametricCurveGraph:
Inheritance graph
[legend]
Collaboration diagram for phystricks.src.ParametricCurveGraph.ParametricCurveGraph:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, f1, f2, llamI, llamF)
 
def speed (self)
 
def curvature (self)
 
def visualParametricCurve (self, xunit, yunit)
 
def tangent_angle (self, llam)
 
def derivative (self, n=1)
 
def put_arrow (self, args)
 
def middle_point (self)
 
def get_point (self, llam, advised=True)
 
def get_tangent_vector (self, llam, advised=False)
 
def get_normal_vector (self, llam, advised=False, normalize=True, Green_convention=False)
 
def get_second_derivative_vector (self, llam, advised=False, normalize=True)
 return the second derivative vector normalised to 1. More...
 
def get_derivative (self, llam, order=1)
 
def get_tangent_segment (self, llam)
 
def get_osculating_circle (self, llam)
 
def get_normal_point (self, x, dy)
 
def length (self, mll=None, Mll=None)
 
def arc_length (self, mll=None, Mll=None)
 
def get_regular_points (self, mll, Mll, dl)
 
def get_wavy_points (self, mll, Mll, dl, dy, xunit=1, yunit=1)
 
def rotate (self, theta)
 
def graph (self, mx, Mx)
 
def __call__ (self, llam, approx=False)
 
def __str__ (self)
 
def reverse (self)
 
def action_on_pspict (self, pspict)
 

Public Attributes

 f1
 
 f2
 
 curve
 
 llamI
 
 llamF
 
 mx
 
 Mx
 
 plotstyle
 
 record_arrows
 
 I
 
 F
 

Private Member Functions

def _bounding_box (self, pspict=None)
 

Private Attributes

 _derivative_dict
 

Constructor & Destructor Documentation

def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.__init__ (   self,
  f1,
  f2,
  llamI,
  llamF 
)
Use the constructor :func:`ParametricCurve`.

INPUT:

- ``f1,f2`` - two functions.

- ``llamI,llamF`` - initial and final values of the parameter.

ATTRIBUTES:

- ``plotpoints`` - (default=50)  number of points to be computed.
           If the function seems wrong, increase that number.
           It can happen with functions like sin(1/x) close to zero:
            such a function have too fast oscillations.

Member Function Documentation

def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.__call__ (   self,
  llam,
  approx = False 
)
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.__str__ (   self)
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph._bounding_box (   self,
  pspict = None 
)
private
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.action_on_pspict (   self,
  pspict 
)
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.arc_length (   self,
  mll = None,
  Mll = None 
)
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.curvature (   self)
return the curvature function.
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.derivative (   self,
  n = 1 
)
Return the parametric curve given by the derivative. (f1,f2) -> (f1',f2').

INPUT:
- ``n`` - an integer (default=1).  If the optional parameter `n` is given, give higher order derivatives. If n=0, return self.

EXAMPLES::

    sage: from phystricks import *
    sage: x=var('x')
    sage: f1=phyFunction(cos(2*x))
    sage: f2=phyFunction(x*exp(2*x))
    sage: F=ParametricCurve(f1,f2)
    sage: print F.derivative()
    <The parametric curve given by
    x(t)=-2*sin(2*t)
    y(t)=2*t*e^(2*t) + e^(2*t)
    between None and None>
    sage: print F.derivative(3)
    <The parametric curve given by
    x(t)=8*sin(2*t)
    y(t)=8*t*e^(2*t) + 12*e^(2*t)
    between None and None>
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_derivative (   self,
  llam,
  order = 1 
)
Return the derivative of the curve. If the curve is f(t),
return f'(t) or f''(t) or higher derivatives.

Return a Point, not a vector. This is not normalised.
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_normal_point (   self,
  x,
  dy 
)
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_normal_vector (   self,
  llam,
  advised = False,
  normalize = True,
  Green_convention = False 
)
Return the outside normal vector to the curve for the value llam of the parameter.
   The vector is normed to 1.

An other way to produce normal vector is to use
self.get_tangent_vector(llam).orthogonal()
However the latter does not guarantee to produce an outside pointing vector.

If you want the second derivative vector, use self.get_derivative(2). This will not produce a normal vector in general.

NOTE:

The normal vector will be outwards with respect to the *local* curvature only.

If you have a contour and you need a outward normal vector, you should pass the 
optional argument `Green_convention=True`. In that case you'll get a vector
that is a rotation by pi/2 of the tangent vector. In that case, you still have
to choose by hand if you take N or -N. But this choice is the same for all
normal vectors of your curve.

I do not know how could a program guess if N or -N is *globally* outwards. 
Let me know if you have a trick :)

EXAMPLES::

    sage: from phystricks import *
    sage: F=ParametricCurve(sin(x),x**2)
    sage: print F.get_normal_vector(0)
    <vector I=<Point(0,0)> F=<Point(0,-1)>>

Tangent and outward normal vector fields to a closed path ::

.. literalinclude:: phystricksContourTgNDivergence.py
.. image:: Picture_FIGLabelFigContourTgNDivergencePICTContourTgNDivergence-for_eps.png
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_osculating_circle (   self,
  llam 
)
Return the osculating circle to the parametric curve.
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_point (   self,
  llam,
  advised = True 
)
Return the point on the curve for the value llam of the parameter.

Add the attribute advised_mark_angle which gives the normal
exterior angle at the given point.
If you want to put a mark on the point P (obtained by get_point),
you should consider to write
    P.put_mark(r,P.advised_mark_angle,text)
The so build angle is somewhat "optimal" for a visual point 
of view. The attribute self.get_point(llam).advised_mark_angle 
is given in degree.

The advised angle is given in degree.

The optional boolean argument <advised> serves to avoid infinite
loops because we use get_point in get_normal_vector.
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_regular_points (   self,
  mll,
  Mll,
  dl 
)
Return a list of points regularly spaced (with respect to the arc length)
by dl. 

- 'mll' is the initial value of the parameter  
- 'Mll' is the end value of the parameter.

In some applications, you prefer to use 
ParametricCurve.getRegularLengthParameter. 
The latter method returns the list of values of the parameter instead
of the list of points. This is what you need if you want to draw 
tangent vectors for example.
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_second_derivative_vector (   self,
  llam,
  advised = False,
  normalize = True 
)

return the second derivative vector normalised to 1.

Parameters
llam- the value of the parameter on which we want the second derivative.
advised- (default=False) If True, the initial point is given with an advised_mark_angle.
normalize- (defautl=True) If True, provides a vector normalized to 1. if False, the norm is not guaranteed and depends on the parametrization.

Note : if the parametrization is not normal, this is not orthogonal to the tangent. If you want a normal vector, use get_normal_vector.

def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_tangent_segment (   self,
  llam 
)
Return a tangent segment of length 2 centred at the given point.
It is essentially two times get_tangent_vector.
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_tangent_vector (   self,
  llam,
  advised = False 
)
returns the tangent vector to the curve for the value of the parameter given by llam.
   The vector is normed to 1.

INPUT::

- ``llam`` - the value of the parameter on which we want the tangent.

- ``advised`` - (default = False) if True, the initial point is returned with its
        advised_mark_angle. This takes quite a long time of computation
        (and creates infinite loops in some circumstances)

EXAMPLES::

    sage: from phystricks import *
    sage: F=ParametricCurve(x,x**2)
    sage: print F.get_tangent_vector(0)
    <vector I=<Point(0,0)> F=<Point(1,0)>>
    sage: print F.get_tangent_vector(1)
    <vector I=<Point(1,1)> F=<Point(1/5*sqrt(5) + 1,2/5*sqrt(5) + 1)>>
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.get_wavy_points (   self,
  mll,
  Mll,
  dl,
  dy,
  xunit = 1,
  yunit = 1 
)
Return a list of points which do a wave around the parametric curve.
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.graph (   self,
  mx,
  Mx 
)
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.length (   self,
  mll = None,
  Mll = None 
)
numerically returns the arc length on the curve between
two bounds of the parameters.

If no parameters are given, return the total length.

INPUT:

- ``mll,Mll`` - the minimal and maximal values of the parameters

OUTPUT:
a number.

EXAMPLES:

The length of the circle of radius `sqrt(2)` in the first quadrant.
We check that we get the correct result up to 0.01::

    sage: from phystricks import *
    sage: curve=ParametricCurve(x,sqrt(2-x**2))
    sage: bool( abs(pi*sqrt(2)/2) - curve.length(0,sqrt(2)) <0.01) 
    True
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.middle_point (   self)
return the middle point of the curve (respect to the arc length)
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.put_arrow (   self,
  args 
)
Add a small arrow at the given positions.

The arrow is a vector of size (by default) 0.01. The set of vectors
is stored in `self.record_arrows`. Thus they can be customized
as any vectors.

EXAMPLES:

In the following example, notice the way one of the arrow is
red and backward.

.. literalinclude:: phystricksContourGreen.py
.. image:: Picture_FIGLabelFigContourGreenPICTContourGreen-for_eps.png
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.reverse (   self)
return the curve in the inverse sense but on the same interval

EXAMPLE::

sage: from phystricks import *
sage: x=var('x')
sage: curve=ParametricCurve(cos(x),sin(x)).graph(0,2*pi).reverse()
sage: print curve
<The parametric curve given by
x(t)=cos(2*pi - t)
y(t)=sin(2*pi - t)
between 0 and 2*pi>
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.rotate (   self,
  theta 
)
Return a new ParametricCurve which graph is rotated by <theta> with respect to self.

theta is given in degree.
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.speed (   self)
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.tangent_angle (   self,
  llam 
)
"Return the angle of the tangent (radian)
def phystricks.src.ParametricCurveGraph.ParametricCurveGraph.visualParametricCurve (   self,
  xunit,
  yunit 
)

Member Data Documentation

phystricks.src.ParametricCurveGraph.ParametricCurveGraph._derivative_dict
private
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.curve
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.F
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.f1
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.f2
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.I
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.llamF
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.llamI
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.mx
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.Mx
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.plotstyle
phystricks.src.ParametricCurveGraph.ParametricCurveGraph.record_arrows

The documentation for this class was generated from the following file: