Taylor expansion crashing (python3)
I type the following in the sage terminal :
f = (x+1)**(0.1)+exp(x)
f.taylor(x,0,3)
That causes me quite a crash I do not understand.
I tried with some variations, like
f = x**(0.1)+exp(x)
f.taylor(x,0,3)
or
f = (x+1)**(0.1)+exp(x)
f.taylor(x,0,2)
Both are working well.
EDIT :
This one
g = 3*(x+1)**(1/10)+exp(x)
g.taylor(x,0,3)
- works well in the sage terminal
- crashes when it is in a file "attach"ed to the sage terminal.
I guess it is due to the Sage's preparser.
Any idea ? Why does the Taylor expansion of that particular function crashes from order 3 ?
If it is important, I'm using a home-compiled version of Sage with python3 :
┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 8.9, Release Date: 2019-09-29 │ │ Using Python 3.7.3. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘
Here is the trace :
┌─────────────────────────────────┐ │ SageMath version 8.9, Release Date: 2019-09-29 │ │ Using Python 3.7.3. Type "help()" for help. │ └─────────────────────────────────┘ sage: f = (x+1)**(0.1)+exp(x)
sage: f.taylor(x,0,3)
RuntimeError Traceback (most recent call last) /home/moky/.Sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __init__(self, parent, value, is_name, name) 707 try: --> 708 self._name = parent._create(value, name=name) 709 except (TypeError, RuntimeError, ValueError) as x:
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in _create(self, value, name) 605 else: --> 606 self.set(name, value) 607 except RuntimeError as error:
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in set(self, var, value) 514 cmd = '%s : %s$'%(var, value.rstrip(';')) --> 515 self.eval(cmd) 516
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in _eval_line(self, line, locals, reformat, **kwds) 460 if statement: --> 461 maxima_eval("#$%s$" % statement) 462 if not reformat:
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:7793)() 805 lispargs = EclObject(list(args)) --> 806 return ecl_wrap(ecl_safe_apply(self.obj,(<eclobject>lispargs).obj)) 807
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:5455)() 377 s = si_coerce_to_base_string(ecl_values(1)) --> 378 raise RuntimeError("ECL says: {}".format( 379 char_to_str(ecl_base_string_pointer_safe(s))))
RuntimeError: ECL says: In function GCD, the value of the first argument is 0.91 which is not of the expected type INTEGER
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last) <ipython-input-2-ed48eb8006d1> in <module>() ----> 1 f.taylor(x,Integer(0),Integer(3))
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.taylor (build/cythonized/sage/symbolic/expression.cpp:27942)() 4581 except Exception: 4582 raise NotImplementedError("Wrong arguments passed to taylor. See taylor? for more details.") -> 4583 l = self._maxima_().taylor(B) 4584 return self.parent()(l) 4585
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __call__(self, args, *kwds) 668 669 def __call__(self, args, *kwds): --> 670 return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds) 671 672 def help(self):
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in function_call(self, function, args, kwds) 589 [s.name() for s in args], 590 ['%s=%s'%(key,value.name()) for key, value in kwds.items()]) --> 591 return self.new(s) 592 593 def _function_call_string(self, function, args, kwds):
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in new(self, code) 358 359 def new(self, code): --> 360 return self(code) 361 362 ###################################################################
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __call__(self, x, name) 286 287 if isinstance(x, string_types): --> 288 return cls(self, x, name=name) 289 try: 290 # Special methods do not and should not have an option to
/home/moky/.Sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __init__(self, parent, value, is_name, name) 708 self._name = parent._create(value, name=name) 709 except (TypeError, RuntimeError, ValueError) as x: --> 710 raise TypeError(x) 711 712 def _latex_(self):
TypeError: ECL says: In function GCD, the value of the first argument is 0.91 which is not of the expected type INTEGER