On 08/16/2010 05:26 PM, Richard wrote: > I'd already posted this problem on the sage-support mailing list, but > the issue could not be resolved. As it appears to be a bug, I am > cross-posting to this list. > > [Please find the original thread on sage-support at > https://groups.google.com/group/sage-support/browse_thread/thread/39b019cd51270574] > > When trying to run the following code to solve a sytem of ODEs, sage > spawns an error message: > > ------------------------------ > t = var ('t') > > S_0 = 1.5 > X_0 = 0.05 > Y_XS = 0.5 > K_S = 0.007 > mu_max = 0.8 > > X = function ('X', t) > S = function ('S', X) > > def mu (S): > return (mu_max * S) / (K_S + S) > > dXdt = diff (X, t) == mu (S) * X > dSdt = diff (S, t) == -mu (S) * X / Y_XS > > desolve_system ([dXdt, dSdt], [X, S], ics = [0, X_0, S_0]) > ------------------------------ > > > Traceback: > > ------------------------------ > Traceback (most recent call last): Y_XS = 0.5 > File "", line 1, in <module> > > File "/tmp/tmpS9OrMD/___code___.py", line 22, in <module> > exec compile(u'desolve_system ([dXdt, dSdt], [X, S], ics = > [_sage_const_0 , X_0, S_0]) > File "", line 1, in <module> > > File > "/opt/sage/local/lib/python2.6/site-packages/sage/calculus/desolvers.py", > line 628, in desolve_system > dvar.atvalue(ivar==ivar_ic, ic) > File > "/opt/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", > line 1408, in __call__ > return self._obj.parent().function_call(self._name, [self._obj] + > list(args), kwds) > File > "/opt/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", > line 1316, in function_call > return self.new(s) > File > "/opt/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", > line 1097, in new > return self(code) > File > "/opt/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", > line 1032, in __call__ > return cls(self, x, name=name) > File > "/opt/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", > line 1451, in __init__ > raise TypeError, x > TypeError: Error executing code in Maxima > CODE: > sage15 : atvalue(sage9,sage13,sage14)$ > Maxima ERROR: > > Improper argument to atvalue: > ['X(t)] > -- an error. To debug this try: debugmode(true); > ------------------------------ > > This is sage 4.5.2 on Linux x86. > > If further (debugging) info is required, please let me know.
This appears to be what raises the error: var('t') X = function('X', t) S = function('S', X) S._maxima_().atvalue(t==0, 1.5) Either of atvalue(S(X(t)), t=0, 1.5); atvalue('S('X(t)), t=0, 1.5); gives this error in Maxima (run with 'sage -maxima'): Improper argument to atvalue: [X(t)] -- an error. To debug this try: debugmode(true); Does atvalue work with composed functions? Do X and S depend linearly on each other in your example? What if you eliminate one and try to solve the remaining ODE? -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org