|
phystricks
|


Public Member Functions | |
| def | __init__ (self, fun, mx, Mx) |
| def | I (self) |
| def | F (self) |
| def | parametric_curve (self) |
| def | visualParametricCurve (self, xunit, yunit) |
| def | inverse (self, y) |
| def | PointsNiveau (self, y) |
| def | roots (self) |
| def | derivative (self, n=1) |
| def | get_point (self, x, advised=True) |
| def | get_normal_vector (self, xx) |
| def | get_tangent_vector (self, x, advised=False, numerical=False) |
| def | get_tangent_segment (self, x) |
| def | tangent_phyFunction (self, x0) |
| def | get_normal_point (self, x, dy) |
| def | get_regular_points (self, mx, Mx, dx) |
| def | getRegularLengthPoints (self, mx, Mx, dx) |
| def | speed (self) |
| def | length (self) |
| def | curvature (self) |
| def | get_wavy_points (self, mx, Mx, dx, dy) |
| def | get_minmax_data (self, mx, Mx) |
| def | xmax (self, deb, fin) |
| def | xmin (self, deb, fin) |
| def | ymax (self, deb, fin) |
| def | ymin (self, deb, fin) |
| def | graph (self, mx, Mx) |
| def | fit_inside (self, xmin, xmax, ymin, ymax) |
| def | surface_under (self, mx=None, Mx=None) |
| def | cut_y (self, ymin, ymax, plotpoints=None) |
| def | mark_point (self, pspict=None) |
| def | angle (self) |
| def | representative_graph_object (self) |
| def | action_on_pspict (self, pspict) |
| def | latex_code (self, language=None, pspict=None) |
| def | __call__ (self, xe, numerical=False) |
| def | __pow__ (self, n) |
| def | __mul__ (self, other) |
| def | __rmul__ (self, other) |
| def | __add__ (self, other) |
| def | __sub__ (self, other) |
| def | __neg__ (self) |
| def | __str__ (self) |
Public Attributes | |
| sage | |
| sageFast | |
| string | |
| fx | |
| tikz | |
| ListeSurface | |
| listeTests | |
| TesteDX | |
| listeExtrema | |
| listeExtrema_analytique | |
| equation | |
| f | |
| mx | |
| Mx | |
| do_cut_y | |
| cut_ymin | |
| cut_ymax | |
| pieces | |
| nul_function | |
| linear_plotpoints | |
Private Member Functions | |
| def | _bounding_box (self, pspict=None) |
Private Attributes | |
| _derivative | |
| _parametric_curve | |
INPUT:
- ``fun`` - sage symbolic expression that is to be interpreted as
a function of `x`.
- ``mx,Mx`` - the initial and end values of the variable.
NOTE :
The end-used has to use :func:`phyFunction` instead. The latter accepts more
types of arguments.
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.__init__ | ( | self, | |
| fun, | |||
| mx, | |||
| Mx | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.__add__ | ( | self, | |
| other | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.__call__ | ( | self, | |
| xe, | |||
numerical = False |
|||
| ) |
return the value of the function at given point
INPUT:
- ``xe`` - a number. The point at which we want to evaluate the function
- ``numerical`` (boolean, default=False) If True, return a numerical_approximation
EXAMPLES::
sage: from phystricks import *
sage: x=var('x')
sage: f=phyFunction(cos(x))
sage: f(1)
cos(1)
sage: f(1,numerical=True)
0.540302305868140
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.__mul__ | ( | self, | |
| other | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.__neg__ | ( | self | ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.__pow__ | ( | self, | |
| n | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.__rmul__ | ( | self, | |
| other | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.__str__ | ( | self | ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.__sub__ | ( | self, | |
| other | |||
| ) |
|
private |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.action_on_pspict | ( | self, | |
| pspict | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.angle | ( | self | ) |
For put_mark.
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.curvature | ( | self | ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.cut_y | ( | self, | |
| ymin, | |||
| ymax, | |||
plotpoints = None |
|||
| ) |
Will not draw the function bellow 'ymin' and over 'ymax'. Will neither join the pieces. This is useful when drawing functions like 1/x. It is wise to use a value of plotpoints that is not a multiple of the difference Mx-mx. The default behaviour is most of time like that. If an other cut_y is already imposed, the most restrictive is used.
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.derivative | ( | self, | |
n = 1 |
|||
| ) |
return the derivative of the function.
INPUT:
- ``n`` - an interger (default = 1) the order of derivative. If n=0, return self.
EXAMPLES::
sage: from phystricks import *
sage: f=phyFunction(x**2)
sage: print f.derivative()
x |--> 2*x
sage: print f.derivative()(3)
6
sage: g(x)=cos(x)
sage: print [g.derivative(i) for i in range(0,5)]
[x |--> cos(x), x |--> -sin(x), x |--> -cos(x), x |--> sin(x), x |--> cos(x)]
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.F | ( | self | ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.fit_inside | ( | self, | |
| xmin, | |||
| xmax, | |||
| ymin, | |||
| ymax | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.get_minmax_data | ( | self, | |
| mx, | |||
| Mx | |||
| ) |
return numerical approximations of min and max of the function on the interval
INPUT:
- ``mx,Mx`` - the interval on which we look at the extrema
OUTPUT:
dictionary conaining `xmax`, `ymax`, `xmin` and `ymin`
Notice that we are only interested in ymax and ymin.
EXAMPLES::
sage: from phystricks import *
sage: f=phyFunction(x)
sage: f.get_minmax_data(-3,pi) # random
In the case of the sine function, the min and max are almost -1 and 1::
sage: from phystricks import *
sage: f=phyFunction(sin(x))
sage: f.get_minmax_data(0,2*pi) # random
NOTE:
This function is victim of the `Trac 10246 <http://trac.sagemath.org/sage_trac/ticket/10246>` The try/except block is a workaround.
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.get_normal_point | ( | self, | |
| x, | |||
| dy | |||
| ) |
return a point at distance `dy` in the normal direction of the point `(x,f(x))`
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.get_normal_vector | ( | self, | |
| xx | |||
| ) |
return a normalized normal vector to the graph of the function at xx
The direction of the vector is outside
INPUT:
- ``x`` - a number, the position at which we want the normal vector
OUTPUT:
a vector
EXAMPLES:
sage: from phystricks import *
sage: x=var('x')
sage: f=phyFunction(x**2)
sage: print f.get_normal_vector(0)
<vector I=<Point(0,0)> F=<Point(0,-1)>>
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.get_point | ( | self, | |
| x, | |||
advised = True |
|||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.get_regular_points | ( | self, | |
| mx, | |||
| Mx, | |||
| dx | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.get_tangent_segment | ( | self, | |
| x | |||
| ) |
Return a tangent segment at point (x,f(x)). The difference with self.get_tangent_vector is that self.get_tangent_segment returns a segment that will be symmetric. The point (x,f(x)) is the center of self.get_tangent_segment.
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.get_tangent_vector | ( | self, | |
| x, | |||
advised = False, |
|||
numerical = False |
|||
| ) |
return a tangent vector at the point (x,f(x))
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.get_wavy_points | ( | self, | |
| mx, | |||
| Mx, | |||
| dx, | |||
| dy | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.getRegularLengthPoints | ( | self, | |
| mx, | |||
| Mx, | |||
| dx | |||
| ) |
return a list of points regularly spaced (with respect to the arc length) on the graph of `self`.
INPUT:
- ``mx,Mx`` - the minimal and maximal values of `x` between we will search for points.
- ``dx`` - the arc length between two points
OUTPUT:
A list of points
EXAMPLES::
sage: from phystricks import *
sage: f=phyFunction(x+1)
sage: print [P.coordinates() for P in f.get_regular_points(-2,2,sqrt(2))] # random
These are almost the points (-1,0),(0,1), and (1,2).
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.graph | ( | self, | |
| mx, | |||
| Mx | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.I | ( | self | ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.inverse | ( | self, | |
| y | |||
| ) |
returns a list of values x such that f(x)=y
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.latex_code | ( | self, | |
language = None, |
|||
pspict = None |
|||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.length | ( | self | ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.mark_point | ( | self, | |
pspict = None |
|||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.parametric_curve | ( | self | ) |
return a parametric curve with the same graph as `self`.
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.PointsNiveau | ( | self, | |
| y | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.representative_graph_object | ( | self | ) |
Return is the object that will be drawn. It serves to control the chain function --> parametric_curve --> interpolation curve
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.roots | ( | self | ) |
return roots of the function as a list of Points. Some can miss !
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.speed | ( | self | ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.surface_under | ( | self, | |
mx = None, |
|||
Mx = None |
|||
| ) |
Return the graph of a surface under the function. If mx and Mx are not given, try to use self.mx and self.Mx, assuming that the method is used on an instance of phyFunctionGraph that inherits from here.
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.tangent_phyFunction | ( | self, | |
| x0 | |||
| ) |
Return the tangent at the given point as a :class:`phyFunction`.
INPUT:
- ``x0`` - a number
OUTPUT:
A :class:`phyFunction` that represents the tangent. This is an affine function.
EXAMPLE::
sage: from phystricks import *
sage: g=phyFunction(cos(x))
sage: print g.tangent_phyFunction(pi/2)
x |--> 1/2*pi - x
sage: g.tangent_phyFunction(pi/2)(1)
1/2*pi - 1
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.visualParametricCurve | ( | self, | |
| xunit, | |||
| yunit | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.xmax | ( | self, | |
| deb, | |||
| fin | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.xmin | ( | self, | |
| deb, | |||
| fin | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.ymax | ( | self, | |
| deb, | |||
| fin | |||
| ) |
| def phystricks.src.phyFunctionGraph.phyFunctionGraph.ymin | ( | self, | |
| deb, | |||
| fin | |||
| ) |
|
private |
|
private |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.cut_ymax |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.cut_ymin |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.do_cut_y |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.equation |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.f |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.fx |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.linear_plotpoints |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.listeExtrema |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.listeExtrema_analytique |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.ListeSurface |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.listeTests |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.mx |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.Mx |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.nul_function |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.pieces |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.sage |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.sageFast |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.string |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.TesteDX |
| phystricks.src.phyFunctionGraph.phyFunctionGraph.tikz |
1.8.11