Changeset 7864:25a5e79d10a7
- Timestamp:
- 12/18/07 22:30:51 (5 years ago)
- Branch:
- default
- Location:
- sage
- Files:
-
- 1 added
- 7 edited
-
calculus/calculus.py (modified) (7 diffs)
-
plot/all.py (modified) (1 diff)
-
plot/plot.py (modified) (4 diffs)
-
plot/plot3d/all.py (modified) (1 diff)
-
plot/plot3d/base.pyx (modified) (1 diff)
-
plot/plot3d/plot3d.py (modified) (1 diff)
-
plot/plot3d/shapes.pyx (modified) (3 diffs)
-
plot/plot3d/shapes2.py (added)
Legend:
- Unmodified
- Added
- Removed
-
sage/calculus/calculus.py
r7525 r7864 592 592 param = A[0] 593 593 f = lambda x: self(x) 594 #f = self.fast_float_function() 594 595 else: 595 596 A = self.variables() … … 2767 2768 return self.parent()(self._maxima_().partfrac(var)) 2768 2769 2769 2770 2770 ################################################################### 2771 # Fast Evaluation 2772 ################################################################### 2773 def fast_float_function(self): 2774 return self._fast_float_() 2775 2776 def _fast_float_(self): 2777 return lambda x: float(self(x)) 2778 2771 2779 2772 2780 class Symbolic_object(SymbolicExpression): … … 2910 2918 if isinstance(self._obj, int): 2911 2919 return True 2920 2921 def _fast_float_(self): 2922 z = float(self) 2923 return lambda x: z 2912 2924 2913 2925 def _recursive_sub(self, kwds): … … 3730 3742 return hash(self._name) 3731 3743 3744 def _fast_float_(self): 3745 return lambda x: x 3746 3732 3747 def _recursive_sub(self, kwds): 3733 3748 # do the replacement if needed … … 4349 4364 return float(f._approx_(float(g))) 4350 4365 4366 def _fast_float_(self): 4367 f = self._operands[0]._fast_float_() 4368 g = self._operands[1]._fast_float_() 4369 return lambda x: f(g(x)) 4370 4351 4371 def __complex__(self): 4352 4372 """ … … 4739 4759 return SymbolicComposition(self, SR(x)) 4740 4760 4761 def _fast_float_(self): 4762 return math.sin 4763 4741 4764 sin = Function_sin() 4742 4765 _syms['sin'] = sin … … 4761 4784 return math.cos(x) 4762 4785 return SymbolicComposition(self, SR(x)) 4786 4787 def _fast_float_(self): 4788 return math.cos 4763 4789 4764 4790 -
sage/plot/all.py
r7861 r7864 9 9 from animate import Animation as animate 10 10 11 from plot3dmatplotlib import (Graphics3d, point3d, line3d, plot3d) 11 # This needs to be deprecated. It's crap and pointless. 12 #from plot3dmatplotlib import (Graphics3d, point3d, line3d, plot3d) 12 13 13 14 from plot3dsoya_wrap import plot3dsoya -
sage/plot/plot.py
r7394 r7864 1471 1471 return to_float_list(xdata), to_float_list(ydata) 1472 1472 1473 def _graphic3d(self, *args, **kwds): 1474 """ 1475 Return 3d version of this graphics primitive. 1476 1477 We call this if the user tries to create a graphic but gives 1478 points (etc) in 3-space instead of in the plane. 1479 """ 1480 raise NotImplementedError, "3d plotting of this primitive not yet implemented" 1481 1473 1482 class GraphicPrimitiveFactory_arrow(GraphicPrimitiveFactory): 1474 1483 def __call__(self, minpoint, maxpoint, **kwds): … … 1612 1621 done = False 1613 1622 if not isinstance(points, (list,tuple)) or \ 1614 (isinstance(points,(list,tuple)) and len(points) == 2): 1623 (isinstance(points,(list,tuple)) and len(points) <= 3 and not 1624 isinstance(points[0], (list,tuple))): 1615 1625 try: 1616 xdata = [float(points[0])] 1617 ydata = [float(points[1])] 1618 done = True 1626 points = [[float(z) for z in points]] 1619 1627 except TypeError: 1620 1628 pass … … 1625 1633 ydata = [] 1626 1634 for z in points: 1635 if len(z) == 3: 1636 return self._graphic3d()(points, coerce=coerce, **kwds) 1627 1637 xdata.append(float(z[0])) 1628 1638 ydata.append(float(z[1])) 1629 1639 else: 1630 xdata = [z[0] for z in points] 1631 ydata = [z[1] for z in points] 1640 for z in points: 1641 if len(z) == 3: 1642 return self._graphic3d()(points, coerce=coerce, **kwds) 1643 xdata.append(z[0]) 1644 ydata.append(z[1]) 1632 1645 1633 1646 return self._from_xdata_ydata(xdata, ydata, True, options=options) … … 1947 1960 pass 1948 1961 return g 1962 1963 def _graphic3d(self): 1964 from sage.plot.plot3d.shapes2 import line3d 1965 return line3d 1949 1966 1950 1967 # unique line instance -
sage/plot/plot3d/all.py
r7732 r7864 1 from shapes import Box, ColorCube, Cone, Cylinder, Line,Arrow, Sphere, Torus, Text as Text3D1 from shapes import Box, ColorCube, Cone, Cylinder, Arrow, Sphere, Torus, Text as Text3D 2 2 from parametric_surface import ParametricSurface, MobiusStrip 3 3 from plot3d import plot3d, axes as axes3d -
sage/plot/plot3d/base.pyx
r7863 r7864 216 216 """ 217 217 INPUT: 218 viewer -- string (default: 'jmol') which viewing system to use. 219 'jmol': an embedded non-OpenGL 3d java applet 220 'tachyon': an embedded ray tracer 221 'java3d': a popup OpenGL 3d java applet 222 filename -- string (default: 'shape'); file to save the image to 223 verbosity -- display information about rendering the figure 218 224 figsize -- (default: 4); x or pair [x,y] for numbers, e.g., [4,4]; controls 219 the size of the output figure 220 225 the size of the output figure. E.g., with jmol the number of 226 pixels in each direction is 100 times figsize[0]. 227 **kwds -- other options, which make sense for particular rendering engines 221 228 """ 222 229 if not isinstance(figsize, (list,tuple)): -
sage/plot/plot3d/plot3d.py
r7861 r7864 68 68 """ 69 69 # Check if f has a fast float evaluation 70 try:71 f = f.fast_float_function()72 except AttributeError:73 # Nope -- no prob.74 pass70 #try: 71 # f = f.fast_float_function() 72 #except AttributeError: 73 # # Nope -- no prob. 74 # pass 75 75 76 76 if texture is None: -
sage/plot/plot3d/shapes.pyx
r7861 r7864 180 180 181 181 182 def Line (start, end, radius, **kwds):182 def LineSegment(start, end, thickness=1, radius=None, **kwds): 183 183 """ 184 Create a cylindar from start to end with radius radius. 184 Create a line segment, which is drawn as a cylinder from start to 185 end with radius radius. 185 186 186 187 EXAMPLES: 187 sage: from sage.plot.plot3d.shapes import Line , Sphere188 sage: from sage.plot.plot3d.shapes import LineSegment, Sphere 188 189 sage: P = (0,0,0.1) 189 190 sage: Q = (0.5,0.6,0.7) 190 191 sage: S = Sphere(.2, color='red').translate(P) + \ 191 192 Sphere(.2, color='blue').translate(Q) + \ 192 Line (P, Q, .05, color='black')193 LineSegment(P, Q, .05, color='black') 193 194 sage: S.show() 194 195 sage: S = Sphere(.1, color='red').translate(P) + \ 195 196 Sphere(.1, color='blue').translate(Q) + \ 196 Line (P, Q, .15, color='black')197 LineSegment(P, Q, .15, color='black') 197 198 sage: S.show() 198 199 … … 200 201 -- Robert Bradshaw 201 202 """ 203 if radius is None: 204 radius = thickness/50.0 202 205 start = vector(RDF, start, sparse=False) 203 206 end = vector(RDF, end, sparse=False) … … 212 215 theta = -acos(diff[2]/height) 213 216 return cyl.rotate(axis, theta).translate(start) 214 217 215 218 def Arrow(start, end, radius, head_radius=None, head_len=None, **kwds): 216 219 if head_radius == None:
Note: See TracChangeset
for help on using the changeset viewer.
