Changeset 7431:99a6a4189ae9
- Timestamp:
- 11/30/07 15:22:25 (5 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/calculus/calculus.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sage/calculus/calculus.py
r7430 r7431 1141 1141 1142 1142 1143 def __call__(self, dict=None, **kwds): 1144 return self.substitute(dict, **kwds) 1143 def __call__(self, *args, **kwds): 1144 """ 1145 EXAMPLES: 1146 sage: x,y=var('x,y') 1147 sage: f = x+y 1148 sage: f.variables() 1149 (x, y) 1150 sage: f() 1151 y + x 1152 sage: f(3) 1153 y + 3 1154 sage: f(3,4) 1155 7 1156 sage: f(2,3,4) 1157 Traceback (most recent call last): 1158 ... 1159 ValueError: the number of arguments must be less than or equal to 2 1160 1161 sage: f({x:3}) 1162 y + 3 1163 sage: f({x:3,y:4}) 1164 7 1165 sage: f(x=3) 1166 y + 3 1167 sage: f(x=3,y=4) 1168 7 1169 """ 1170 if len(args) == 0: 1171 d = None 1172 elif len(args) == 1 and isinstance(args[0], dict): 1173 d = args[0] 1174 else: 1175 d = {} 1176 vars = self.variables() 1177 for i in range(len(args)): 1178 try: 1179 d[ vars[i] ] = args[i] 1180 except IndexError: 1181 raise ValueError, "the number of arguments must be less than or equal to %s"%len(self.variables()) 1182 1183 return self.substitute(d, **kwds) 1145 1184 1146 1185 def power_series(self, base_ring):
Note: See TracChangeset
for help on using the changeset viewer.
