[sage-support] Re: integral
On Sep 23, 3:32 pm, sps wrote: > > So sometimes even if you *do* have assumptions working properly, there > > are so many paths in the decision tree that it would be very hard to > > do this sort of thing. I hope that helps you - I guess to me that is > > one thing that makes math interesting! > > > - kcrisman > > Yes, it is what makes math very interesting, and powerful!! > > But, how you know what assumption I have to do? What I meant was that something that makes math interesting is that you *don't* know ahead of time which assumptions you'd have to make! In this case I just looked at the error messages, assumed something relevant each time, and then put them together. For whichever integral you're doing, you may have to do this. For your specific case, I think that using Maxima straight up might be helpful, since it was designed to be used with a user interacting (to answer the questions, for instance): sage: maxima_console() The syntax is slightly different, and you have to end input with a semicolon (;) in order to get results. Good luck! - kcrisman -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] default browser for notebook
Hi Johannes, On Fri, Sep 24, 2010 at 5:47 AM, Johannes wrote: > hi list, > how can i change the browser, which is started after i started sage > notebook by `sage -notebook` > I want to use firefox, but i always get a new instance of konquer. You could set the Sage environment variable SAGE_BROWSER: $ export SAGE_BROWSER=/path/to/firefox $ For more environment variables, see the file sage/misc/viewer.py -- Regards Minh Van Nguyen -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] default browser for notebook
hi list, how can i change the browser, which is started after i started sage notebook by `sage -notebook` I want to use firefox, but i always get a new instance of konquer. greatz Johannes -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: integral
> So sometimes even if you *do* have assumptions working properly, there > are so many paths in the decision tree that it would be very hard to > do this sort of thing. I hope that helps you - I guess to me that is > one thing that makes math interesting! > > - kcrisman Yes, it is what makes math very interesting, and powerful!! But, how you know what assumption I have to do? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: integral
On Sep 23, 1:37 pm, sps wrote: > And why is it? I do an assignement but it doesn't accept it: > > TypeError: Computation failed since Maxima requested additional > constraints (try the command 'assume((a-1)*(a+1)>0)' before integral > or limit evaluation, for example): > Is (a-1)*(a+1) positive, negative, or zero? > sage: assume((a-1)*(a+1)>0) > sage: integral(cos(t)/(a+cos(t)),t,0,2*pi) > ERROR: An unexpected error occurred while tokenizing input Unfortunately, Maxima's assumption framework (as discussed elsewhere on the Sage lists currently) is not really that strong, and it turns out that in this case the error message we give you in Sage won't be enough to do it. In general, it isn't possible to anticipate all the possible assumptions one might need, and it's not worth doing it recursively because of what I just said. In this case, I ended up having to answer four different questions to cycle through in Maxima: sage: var('a t') (a, t) sage: assume(a>-1) sage: assume(a>1) sage: assume(sqrt(a^2-1)+a-1>0) sage: assume(abs(sqrt(a^2-1)-a)-1>0) sage: integral(cos(t)/(a+cos(t)),t,0,2*pi) 2*pi Notice that the questions change if you make different assumptions: sage: forget() sage: assume(a>-1) sage: assume(a<1) sage: assume(acos(a)+pi>0) sage: assume(acos(a)-pi>0) sage: integral(cos(t)/(a+cos(t)),t,0,2*pi) ValueError: Integral is divergent. So sometimes even if you *do* have assumptions working properly, there are so many paths in the decision tree that it would be very hard to do this sort of thing. I hope that helps you - I guess to me that is one thing that makes math interesting! - kcrisman -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Wrapping C++
On Thu, Sep 23, 2010 at 6:57 AM, Bruce wrote: > I have a C++ function I want to call from sage. I have attempted to > follow the example in > http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html > > This was unsuccessful. The C++ class is not recognised. The problem > seems to be that this is Cython v0.13 whereas sage 4.5.2 (which I am > using) and sage 4.5.3 uses Cython v0.12. > > If this is correct the options seem to be to use cython v0.12 (in > which case I don't have documentation) or to upgrade to cython v0.13 > (which I don't know how to do). > > Here is how I tried to read in my C++ header file: > > cdef extern from "/home/masdbn/planargraph/Graph.hpp" namespace > PlanarGraph: > cdef cppclass Graph: > pass > > Where do I go from here? Thanks You have to wrap it the old style way: http://wiki.cython.org/WrappingCPlusPlus?action=recall&rev=24 Or get someone to review http://trac.sagemath.org/sage_trac/ticket/9828 so we can get 0.13 into Sage. - Robert -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: integral
And why is it? I do an assignement but it doesn't accept it: TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume((a-1)*(a+1)>0)' before integral or limit evaluation, for example): Is (a-1)*(a+1) positive, negative, or zero? sage: assume((a-1)*(a+1)>0) sage: integral(cos(t)/(a+cos(t)),t,0,2*pi) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (441, 0)) --- TypeError Traceback (most recent call last) /home/saverio/sage/ in () /home/saverio/sage/local/lib/python2.6/site-packages/sage/misc/ functional.pyc in integral(x, *args, **kwds) 716 """ 717 if hasattr(x, 'integral'): --> 718 return x.integral(*args, **kwds) 719 else: 720 from sage.symbolic.ring import SR /home/saverio/sage/local/lib/python2.6/site-packages/sage/symbolic/ expression.so in sage.symbolic.expression.Expression.integral (sage/ symbolic/expression.cpp:29088)() /home/saverio/sage/local/lib/python2.6/site-packages/sage/symbolic/ integration/integral.pyc in integrate(expression, v, a, b, algorithm) 587 return indefinite_integral(expression, v) 588 else: --> 589 return definite_integral(expression, v, a, b) 590 591 integral= integrate /home/saverio/sage/local/lib/python2.6/site-packages/sage/symbolic/ function.so in sage.symbolic.function.Function.__call__ (sage/symbolic/ function.cpp:4503)() /home/saverio/sage/local/lib/python2.6/site-packages/sage/symbolic/ integration/integral.pyc in _eval_(self, f, x, a, b) 172 for integrator in self.integrators: 173 try: --> 174 return integrator(*args) 175 except NotImplementedError: 176 pass /home/saverio/sage/local/lib/python2.6/site-packages/sage/symbolic/ integration/external.pyc in maxima_integrator(expression, v, a, b) 19 else: 20 try: ---> 21 result = expression._maxima_().integrate(v, a, b) 22 except TypeError, error: 23 s = str(error) /home/saverio/sage/local/lib/python2.6/site-packages/sage/interfaces/ maxima.pyc in integral(self, var, min, max) 2110 if max is None: 2111 raise ValueError, "neither or both of min/max must be specified." -> 2112 return I(var, min, max) 2113 2114 integrate = integral /home/saverio/sage/local/lib/python2.6/site-packages/sage/interfaces/ expect.pyc in __call__(self, *args, **kwds) 1406 1407 def __call__(self, *args, **kwds): -> 1408 return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds) 1409 1410 def help(self): /home/saverio/sage/local/lib/python2.6/site-packages/sage/interfaces/ expect.pyc in function_call(self, function, args, kwds) 1314[s.name() for s in args], 1315['%s=%s'% (key,value.name()) for key, value in kwds.items()]) -> 1316 return self.new(s) 1317 1318 def _function_call_string(self, function, args, kwds): /home/saverio/sage/local/lib/python2.6/site-packages/sage/interfaces/ expect.pyc in new(self, code) 1095 1096 def new(self, code): -> 1097 return self(code) 1098 1099 ### /home/saverio/sage/local/lib/python2.6/site-packages/sage/interfaces/ expect.pyc in __call__(self, x, name) 1030 1031 if isinstance(x, basestring): -> 1032 return cls(self, x, name=name) 1033 try: 1034 return self._coerce_from_special_method(x) /home/saverio/sage/local/lib/python2.6/site-packages/sage/interfaces/ expect.pyc in __init__(self, parent, value, is_name, name) 1449 except (TypeError, KeyboardInterrupt, RuntimeError, ValueError), x: 1450 self._session_number = -1 -> 1451 raise TypeError, x 1452 self._session_number = parent._session_number 1453 TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume((a-1)*(a+1)>0)' before integral or limit evaluation, for example): Is (a-1)*(a+1) positive, negative, or zero? sage: constraint --- NameError Traceback (most recent call last) /home/saverio/sage/ in () NameError: name 'constraint' is not defined sage: integral(cos(t)/(a+cos(t)),t,0,2*pi) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (441, 0)) --
Re: [sage-support] Exclusive-or of hexadecimal strings?
Hi Alasdair, On Thu, Sep 23, 2010 at 11:40 PM, Alasdair wrote: > Is there a more direct way? In python, the operator ^ is supposed to > implement x-or on strings, but of course in Sage that operator is > recognized as an exponential, and so gives an error. Maybe fiddling with the preparser is not what you want. You could use the xor() function built into Python without toggling the preparsing: sage: from operator import xor sage: hex(xor(0x2bd5427c, 0x65ef24ab)) '4e3a66d7' -- Regards Minh Van Nguyen -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Problems with chromium (and firefox)
Hi, For some reason I don't know the output of the help pages (like the tutorial) have tiny scroll boxes around. I am using chromium. With firefox there is not such problem, but the reference manual hangs it. What am I doing wrong? Antonio -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Wrapping C++
I have a C++ function I want to call from sage. I have attempted to follow the example in http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html This was unsuccessful. The C++ class is not recognised. The problem seems to be that this is Cython v0.13 whereas sage 4.5.2 (which I am using) and sage 4.5.3 uses Cython v0.12. If this is correct the options seem to be to use cython v0.12 (in which case I don't have documentation) or to upgrade to cython v0.13 (which I don't know how to do). Here is how I tried to read in my C++ header file: cdef extern from "/home/masdbn/planargraph/Graph.hpp" namespace PlanarGraph: cdef cppclass Graph: pass Where do I go from here? Thanks -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Exclusive-or of hexadecimal strings?
Hi Alasdair, On Thu, Sep 23, 2010 at 11:40 PM, Alasdair wrote: > Is there a more direct way? In python, the operator ^ is supposed to > implement x-or on strings, but of course in Sage that operator is > recognized as an exponential, and so gives an error. You could try turning the preparser and using hexadecimal notation: sage: version() 'Sage Version 4.5.3, Release Date: 2010-09-04' sage: preparser(False) sage: hex(0x2bd5427c ^ 0x65ef24ab) '0x4e3a66d7' -- Regards Minh Van Nguyen -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Exclusive-or of hexadecimal strings?
Suppose I define h1 = '2bd5427c' h2 = '65ef24ab' Then I can obtain their exclusive-or by first converting to an integer, and back again after: hex(ZZ(h1,16)^^ZZ(h2,16)) which produces the correct value '4e3a66d7' Is there a more direct way? In python, the operator ^ is supposed to implement x-or on strings, but of course in Sage that operator is recognized as an exponential, and so gives an error. Thanks, Alasdair -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: Function assume() has no effect on Maxima via desolve()
On Wed, 22 Sep 2010 18:52:32 -0700 (PDT) lutusp wrote: > > The patch by Robert Marik attached to #9835 solves the problem you > > show below. > > Applied the indicated patch, same outcome: > > reset() > var('g t') > x = function('x',t) > forget() > assume(g > 0) > de = x - g * diff(x,t,2) > desolve(de,x,ivar=t) > > Traceback (most recent call last):desolve(de,x,ivar=t) > TypeError: Computation failed since Maxima requested additional > constraints (try the command 'assume(g>0)' before integral or limit > evaluation, for example): > Is g positive or negative? Did you run "./sage -br" to build sage after you applied the patch? I get this: sage: reset() sage: var('g t') (g, t) sage: x = function('x',t) sage: forget() sage: assume(g > 0) sage: de = x - g * diff(x,t,2) sage: desolve(de,x,ivar=t) k1*e^(t/sqrt(g)) + k2*e^(-t/sqrt(g)) Cheers, Burcin -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org