Code ok on SageMathCloud but error on Sagemath VM

asked 2017-05-05 05:10:58 -0600

ortollj gravatar image

updated 2017-05-05 07:06:47 -0600

hello Why the same code looks ok on sageMathcloud and generates an error on sagemath VM ? Maybe the way to write the code is not good, but why 2 different results ?

Sage Math Cloud Result Ok

Sage Math VM Code Error

t = var('t') # define a variable t
m = var('m') # define a variable ODE coeff m
b = var('b') # define a variable ODE coeff b
c = var('c') # define a variable ODE coeffc
x = function('x')(t) # define x to be a function of that variable
#
assume(4*c*m+b^2>0)
DES = m*diff(x, t,2) + b*diff(x, t,1) - c*x
ySup=desolve(DES, [x,t])
#
forget()
assume(4*c*m+b^2==0) 
DE0 = m*diff(x, t,2) + b*diff(x, t,1) - c*x
y0=desolve(DE0, [x,t])
#
forget()
DEI = m*diff(x, t,2) + b*diff(x, t,1) - c*x
assume(4*c*m+b^2<0) 
yInf=desolve(DEI, [x,t])
show(yInf)
show(y0)
show(ySup)
show ("########## Now Latex Code ###########")
latex(yInf)
latex(y0)
latex(ySup)

the error below:

TypeError Traceback (most recent call last) <ipython-input-1-20eb09c83522> in <module>() 12 assume(Integer(4)cm+b*Integer(2)==Integer(0)) 13 DE0 = mdiff(x, t,Integer(2)) + bdiff(x, t,Integer(1)) - cx ---> 14 y0=desolve(DE0, [x,t]) 15 # 16 forget()

/home/sage/sage-7.6/local/lib/python2.7/site-packages/sage/calculus/desolvers.pyc in desolve(de, dvar, ics, ivar, show_method, contrib_ode) 455 # we produce string like this 456 # ode2('diff(y,x,2)+2*'diff(y,x,1)+y-cos(x),y(x),x) --> 457 soln = P(cmd) 458 459 if str(soln).strip() == 'false':

/home/sage/sage-7.6/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in __call__(self, x, name) 243 244 if isinstance(x, six.string_types): --> 245 return cls(self, x, name=name) 246 try: 247 return self._coerce_from_special_method(x)

/home/sage/sage-7.6/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in __init__(self, parent, value, is_name, name) 671 self._name = parent._create(value, name=name) 672 except (TypeError, RuntimeError, ValueError) as x: --> 673 raise TypeError(x) 674 675 def _latex_(self):

TypeError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation may help (example of legal syntax is 'assume(b>0)', see assume? for more details) Is b zero or nonzero?

edit retag flag offensive close merge delete

Comments

SageMathCloud provides a modifed version of Sage and the set of modifications do not all of them get merged into Sage.

Meanwhile, I suggest that you add assume(b>0) or assume(b==0) somewhere as requested.

Sébastien gravatar imageSébastien ( 2017-05-09 07:27:17 -0600 )edit

I don't understand why on the VM this code is ok:

t = var('t') # define a variable t
m = var('m') # define a variable ODE coeff m
b = var('b') # define a variable ODE coeff b
c = var('c') # define a variable ODE coeffc
x = function('x')(t) # define x to be a function of that variable
forget()
assume((-4*c*m+b^2)>0 )
DES = m*diff(x, t,2) + b*diff(x, t,1) + c*x
ySup=desolve(DES, [x,t])
forget()
assume((-4*c*m+b^2)<0 ) 
DEI = m*diff(x, t,2) + b*diff(x, t,1) + c*x
yInf=desolve(DEI, [x,t])
#
show(yInf)
show(ySup)
show ("########## Now Latex Code ###########")
latex(yInf)
latex(ySup)

but this one is KO

forget()
assume((-4*c*m+b^2)==0 ) 
DE0 = m*diff(x, t,2) + b*diff(x, t,1) + c
y0=desolve(DE0, [x,t])
ortollj gravatar imageortollj ( 2017-05-23 12:26:57 -0600 )edit