/[escript]/branches/symbolic_from_3470/escript/py_src/symbolic/functions.py
ViewVC logotype

Diff of /branches/symbolic_from_3470/escript/py_src/symbolic/functions.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3473 by caltinay, Wed Mar 16 05:54:30 2011 UTC revision 3474 by caltinay, Thu Mar 17 00:19:36 2011 UTC
# Line 117  class whereNonNegative(Function): Line 117  class whereNonNegative(Function):
117      def _eval_derivative(self, x):      def _eval_derivative(self, x):
118          return S.Zero          return S.Zero
119    
120    class whereZero(Function):
121        """Returns:
122             1 where expr == 0
123             0 else
124        """
125        nargs = 1
126        is_bounded = True
127        is_negative = False
128        is_real = True
129    
130        @classmethod
131        def eval(cls, arg):
132            if arg is S.NaN:
133                return S.NaN
134            if arg.is_zero: return S.One
135            if arg.is_nonzero: return S.Zero
136            if arg.is_Function:
137                if arg.func is whereZero: return 1-arg
138    
139        def _eval_conjugate(self):
140            return self
141    
142        def _eval_derivative(self, x):
143            return S.Zero
144    
145    class whereNonZero(Function):
146        """Returns:
147             0 where expr == 0
148             1 else
149        """
150        nargs = 1
151        is_bounded = True
152        is_negative = False
153        is_real = True
154    
155        @classmethod
156        def eval(cls, arg):
157            return 1-whereZero(arg)
158    
159        def _eval_conjugate(self):
160            return self
161    
162        def _eval_derivative(self, x):
163            return S.Zero
164    
165    class log10(Function):
166        """Returns the base-10 logarithm of the argument (same as log(x,10))
167        """
168        nargs = 1
169    
170        @classmethod
171        def eval(cls, arg):
172            from sympy.functions.elementary.exponential import log
173            return log(arg,10)
174    
175    class inverse(Function):
176        """Returns the inverse of the argument
177        """
178        nargs = 1
179    
180    class minval(Function):
181        """Returns the minimum value over all components of the argument
182        """
183        nargs = 1
184    
185    class maxval(Function):
186        """Returns the maximum value over all components of the argument
187        """
188        nargs = 1
189    
190    class trace(Function):
191        """Returns the trace of the argument with optional axis_offset
192        """
193        nargs = (1,2)
194    
195    class transpose(Function):
196        """Returns the transpose of the argument
197        """
198        nargs = (1,2)
199    
200    class symmetric(Function):
201        """Returns the symmetric part of the argument
202        """
203        nargs = 1
204    
205    class nonsymmetric(Function):
206        """Returns the non-symmetric part of the argument
207        """
208        nargs = 1
209    
210    class swap_axes(Function):
211        """Returns the 'swap' of the argument
212        """
213        nargs = (1,2,3)
214    
215    class grad(Function):
216        """Returns the spatial gradient of the argument
217        """
218        nargs = (1,2)
219    
220  #  #
221  # vim: expandtab shiftwidth=4:  # vim: expandtab shiftwidth=4:

Legend:
Removed from v.3473  
changed lines
  Added in v.3474

  ViewVC Help
Powered by ViewVC 1.1.26