[sage-support] Coefficient of Boolean Polynomial
In my Sage code, R.v1, v2, v3=BooleanPolynomialRing(3) f=v1*v2+v1*v3+v1 print f.coefficient(v1) I am getting Traceback (click to the left of this block for traceback) ... AttributeError: 'sage.rings.polynomial.pbori.BooleanPolynomial' object has no attribute 'coefficient' Answer should be v2+v3+1. I do not want to use R.v1, v2, v3=GF(2)[] as in this ring operations are much slower than R.v1, v2, v3=BooleanPolynomialRing(3). -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Why solve(5^( x -1) == (0.04)^(2*x), x) returns empty set?
Why 0.04 ? Th notebook says : S=(5^( x -1) == (0.04)^(2*x)).subs({0.04:1/25}).log().solve(x) ; S [x == log(5)/(2*log(25) + log(5))] bool(S[0].rhs()==1/5) True (The last step is easily done by mental computation ; this is only a check.). HTH, -- Emmanuel Charpentier Le dimanche 16 novembre 2014 19:54:20 UTC+1, RRogers a écrit : Apparently the default solver doesn't do logarithms. For the default try: solve(log(5^( x -1)) == log((0.04)^(2*x)), x) [x == 8104022*log(5)/(8104022*log(5) + 52171681)] -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Why solve(5^( x -1) == (0.04)^(2*x), x) returns empty set?
If you ask Sage to do something it can't, like solve a quintic polynomial equation, it will spit the question back at you. If Sage did that I'd be fine. However, Sage spit back the empty set which is the WRONG answer and far different yes? On Sunday, November 16, 2014 12:54:20 PM UTC-6, RRogers wrote: Apparently the default solver doesn't do logarithms. For the default try: solve(log(5^( x -1)) == log((0.04)^(2*x)), x) [x == 8104022*log(5)/(8104022*log(5) + 52171681)] -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Why solve(5^( x -1) == (0.04)^(2*x), x) returns empty set?
I didn't *need* to have 0.04. This is just a command that actually came up in real work. I didn't want to alter it in any way lest it may be a genuine bug. cs On Monday, November 17, 2014 6:48:04 AM UTC-6, Emmanuel Charpentier wrote: Why 0.04 ? Th notebook says : S=(5^( x -1) == (0.04)^(2*x)).subs({0.04:1/25}).log().solve(x) ; S [x == log(5)/(2*log(25) + log(5))] bool(S[0].rhs()==1/5) True (The last step is easily done by mental computation ; this is only a check.). HTH, -- Emmanuel Charpentier Le dimanche 16 novembre 2014 19:54:20 UTC+1, RRogers a écrit : Apparently the default solver doesn't do logarithms. For the default try: solve(log(5^( x -1)) == log((0.04)^(2*x)), x) [x == 8104022*log(5)/(8104022*log(5) + 52171681)] -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Coefficient of Boolean Polynomial
Santanu wrote: R.v1, v2, v3=BooleanPolynomialRing(3) f=v1*v2+v1*v3+v1 print f.coefficient(v1) I am getting Traceback (click to the left of this block for traceback) ... AttributeError: 'sage.rings.polynomial.pbori.BooleanPolynomial' object has no attribute 'coefficient' Answer should be v2+v3+1. I do not want to use R.v1, v2, v3=GF(2)[] as in this ring operations are much slower than R.v1, v2, v3=BooleanPolynomialRing(3). Here v1 divides f so you could do sage: sum(m/v1 for m in f.monomials()) Without that assumption you could do sage: sum(m/v1 for m in (f-f(v1=0)).monomials()) -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] simple 'solve' error, possibly related to ecl and maxima installation
Hi sage-support, I'm a complete newbie to sage. Currently I started learning the very first example in the tutorial on algebra, but got the following error in 'solve'. I'm running OS X 10.9.5, and sage version is 6.4. sage: x=var('x') sage: solve(x^2 + 3*x + 2, x) In file included from /Applications/sage/local/lib/ecl/ecl/ecl-cmp.h:22:0, from /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001XIVVfM.c:5: /Applications/sage/local/lib/ecl/ecl/ecl.h:20:65: fatal error: sys/types.h: No such file or directory #include sys/types.h /* size_t, pthread_t, pthread_mutex_t */ ^ compilation terminated. ;;; Internal error: ;;; ** Error code 1 when executing ;;; (RUN-PROGRAM gcc (-I. -I/Applications/sage/local/lib/ecl/ -I/Users/buildslave-sage/slave/sage_git/build/local/include -I/Users/buildslave-sage/slave/sage_git/build/local/include -g -O2 -fPIC -fno-common -Ddarwin -O2 -c /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001XIVVfM.c -o /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001XIVVfM.o)) --- RuntimeError Traceback (most recent call last) ipython-input-2-b5c9e6391cf6 in module() 1 solve(x**Integer(2) + Integer(3)*x + Integer(2), x) /Applications/sage/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds) 732 from sage.symbolic.expression import is_Expression 733 if is_Expression(f): # f is a single expression -- 734 ans = f.solve(*args,**kwds) 735 return ans 736 /Applications/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.solve (build/cythonized/sage/symbolic/expression.cpp:45798)() /Applications/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._maxima_ (build/cythonized/sage/symbolic/expression.cpp:5388)() /Applications/sage/local/lib/python2.7/site-packages/sage/structure/sage_object.so in sage.structure.sage_object.SageObject._interface_ (build/cythonized/sage/structure/sage_object.c:4897)() /Applications/sage/local/lib/python2.7/site-packages/sage/misc/lazy_import.so in sage.misc.lazy_import.LazyImport.__getattr__ (build/cythonized/sage/misc/lazy_import.c:3030)() /Applications/sage/local/lib/python2.7/site-packages/sage/misc/lazy_import.so in sage.misc.lazy_import.LazyImport._get_object (build/cythonized/sage/misc/lazy_import.c:2030)() /Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py in module() 79 ecl_eval((setf *compile-verbose* NIL)) 80 ecl_eval((setf *load-verbose* NIL)) --- 81 ecl_eval((require 'maxima)) 82 ecl_eval((in-package :maxima)) 83 ecl_eval((setq $nolabels t))) /Applications/sage/local/lib/python2.7/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (build/cythonized/sage/libs/ecl.c:9161)() /Applications/sage/local/lib/python2.7/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (build/cythonized/sage/libs/ecl.c:9094)() /Applications/sage/local/lib/python2.7/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_safe_eval (build/cythonized/sage/libs/ecl.c:4494)() RuntimeError: ECL says: The variable C::GAZONK is unbound. When I type solve(x^2+3*x+2,x) again, the error message changes to this: sage: solve(x^2 + 3*x + 2, x) --- RuntimeError Traceback (most recent call last) ipython-input-3-b5c9e6391cf6 in module() 1 solve(x**Integer(2) + Integer(3)*x + Integer(2), x) /Applications/sage/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds) 732 from sage.symbolic.expression import is_Expression 733 if is_Expression(f): # f is a single expression -- 734 ans = f.solve(*args,**kwds) 735 return ans 736 /Applications/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.solve (build/cythonized/sage/symbolic/expression.cpp:45798)() /Applications/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._maxima_ (build/cythonized/sage/symbolic/expression.cpp:5388)() /Applications/sage/local/lib/python2.7/site-packages/sage/structure/sage_object.so in sage.structure.sage_object.SageObject._interface_ (build/cythonized/sage/structure/sage_object.c:4897)() /Applications/sage/local/lib/python2.7/site-packages/sage/misc/lazy_import.so in sage.misc.lazy_import.LazyImport.__getattr__ (build/cythonized/sage/misc/lazy_import.c:3030)() /Applications/sage/local/lib/python2.7/site-packages/sage/misc/lazy_import.so in
[sage-support] Re: simple 'solve' error, possibly related to ecl and maxima installation
I run the following code: $ sage -maxima And the messages are: ;;; Loading #P/Applications/sage/local/lib/ecl/cmp.fas ;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0 ;;; ;;; End of Pass 1.In file included from /Applications/sage/local/lib/ecl/ecl/ecl-cmp.h:22:0, from /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001IqKQ2b.c:5: /Applications/sage/local/lib/ecl/ecl/ecl.h:20:65: fatal error: sys/types.h: No such file or directory #include sys/types.h /* size_t, pthread_t, pthread_mutex_t */ ^ compilation terminated. ;;; Internal error: ;;; ** Error code 1 when executing ;;; (RUN-PROGRAM gcc (-I. -I/Applications/sage/local/lib/ecl/ -I/Users/buildslave-sage/slave/sage_git/build/local/include -I/Users/buildslave-sage/slave/sage_git/build/local/include -g -O2 -fPIC -fno-common -Ddarwin -O2 -c /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001IqKQ2b.c -o /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001IqKQ2b.o)) Condition of type: UNBOUND-VARIABLE The variable C::GAZONK is unbound. No restarts available. Top level. So the problem lies in Maxima? I also tried 'sage -ecl' and it seems normal. Thanks in advance. 在 2014年11月18日星期二UTC+8上午8时14分25秒,Bozh写道: Hi sage-support, I'm a complete newbie to sage. Currently I started learning the very first example in the tutorial on algebra, but got the following error in 'solve'. I'm running OS X 10.9.5, and sage version is 6.4. sage: x=var('x') sage: solve(x^2 + 3*x + 2, x) In file included from /Applications/sage/local/lib/ecl/ecl/ecl-cmp.h:22:0, from /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001XIVVfM.c:5: /Applications/sage/local/lib/ecl/ecl/ecl.h:20:65: fatal error: sys/types.h: No such file or directory #include sys/types.h /* size_t, pthread_t, pthread_mutex_t */ ^ compilation terminated. ;;; Internal error: ;;; ** Error code 1 when executing ;;; (RUN-PROGRAM gcc (-I. -I/Applications/sage/local/lib/ecl/ -I/Users/buildslave-sage/slave/sage_git/build/local/include -I/Users/buildslave-sage/slave/sage_git/build/local/include -g -O2 -fPIC -fno-common -Ddarwin -O2 -c /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001XIVVfM.c -o /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001XIVVfM.o)) --- RuntimeError Traceback (most recent call last) ipython-input-2-b5c9e6391cf6 in module() 1 solve(x**Integer(2) + Integer(3)*x + Integer(2), x) /Applications/sage/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds) 732 from sage.symbolic.expression import is_Expression 733 if is_Expression(f): # f is a single expression -- 734 ans = f.solve(*args,**kwds) 735 return ans 736 /Applications/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.solve (build/cythonized/sage/symbolic/expression.cpp:45798)() /Applications/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._maxima_ (build/cythonized/sage/symbolic/expression.cpp:5388)() /Applications/sage/local/lib/python2.7/site-packages/sage/structure/sage_object.so in sage.structure.sage_object.SageObject._interface_ (build/cythonized/sage/structure/sage_object.c:4897)() /Applications/sage/local/lib/python2.7/site-packages/sage/misc/lazy_import.so in sage.misc.lazy_import.LazyImport.__getattr__ (build/cythonized/sage/misc/lazy_import.c:3030)() /Applications/sage/local/lib/python2.7/site-packages/sage/misc/lazy_import.so in sage.misc.lazy_import.LazyImport._get_object (build/cythonized/sage/misc/lazy_import.c:2030)() /Applications/sage/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py in module() 79 ecl_eval((setf *compile-verbose* NIL)) 80 ecl_eval((setf *load-verbose* NIL)) --- 81 ecl_eval((require 'maxima)) 82 ecl_eval((in-package :maxima)) 83 ecl_eval((setq $nolabels t))) /Applications/sage/local/lib/python2.7/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (build/cythonized/sage/libs/ecl.c:9161)() /Applications/sage/local/lib/python2.7/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (build/cythonized/sage/libs/ecl.c:9094)() /Applications/sage/local/lib/python2.7/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_safe_eval (build/cythonized/sage/libs/ecl.c:4494)() RuntimeError: ECL says: The variable C::GAZONK is unbound. When I type solve(x^2+3*x+2,x) again, the error message changes to
[sage-support] Re: simple 'solve' error, possibly related to ecl and maxima installation
On Monday, November 17, 2014 8:49:14 PM UTC-5, Bozh wrote: I run the following code: $ sage -maxima And the messages are: Can you see what is in $ ls /usr/include/sys/ presumably types.h should be there. Did you download a binary? Can you say precisely which one you downloaded? It's possible that this one requires some developer headers or something, though that would be unfortunate. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] simple 'solve' error, possibly related to ecl and maxima installation
In my Mac the directory '/usr/include/sys/' does not exist, and I’ve no idea about this. Yes, I downloaded a binary from this link: http://mirrors.hustunique.com/sagemath/osx/intel/index.html and I chose the *10.9_x86_64-app.dmg. Shall I use *10.9_x86_64.dmg instead? On Nov 18, 2014, at 10:10 AM, kcrisman kcris...@gmail.com wrote: On Monday, November 17, 2014 8:49:14 PM UTC-5, Bozh wrote: I run the following code: $ sage -maxima And the messages are: Can you see what is in $ ls /usr/include/sys/ presumably types.h should be there. Did you download a binary? Can you say precisely which one you downloaded? It's possible that this one requires some developer headers or something, though that would be unfortunate. -- You received this message because you are subscribed to a topic in the Google Groups sage-support group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/wj4ObDhv_xE/unsubscribe. To unsubscribe from this group and all its topics, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: simple 'solve' error, possibly related to ecl and maxima installation
On Monday, November 17, 2014 5:49:14 PM UTC-8, Bozh wrote: ;;; (RUN-PROGRAM gcc (-I. -I/Applications/sage/local/lib/ecl/ -I/Users/buildslave-sage/slave/sage_git/build/local/include -I/Users/buildslave-sage/slave/sage_git/build/local/include -g -O2 -fPIC -fno-common -Ddarwin -O2 -c /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001IqKQ2b.c -o /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001IqKQ2b.o)) Condition of type: UNBOUND-VARIABLE The variable C::GAZONK is unbound. You probably downloaded a binary? By the looks of it, ecl has some paths hard-baked into it: -I/Users/buildslave-sage/slave/sage_git/build/local/include. That path probably doesn't exist on your computer, but it was present on the mac on which the binary was built. Compilation would probably fail anyway, because you probably don't have a gcc that is compatible with the rest of the build (I assume we're not shipping gcc with our binary). The odd thing is that maxima deems it necessary to compile itself. Your binary should have a precompiled maxima available already. Something must have gotten damaged or the binary distribution from which you started is broken/incompatible with your OSX. First thing to try might be to try and install a fresh binary if you haven't done so already. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: simple 'solve' error, possibly related to ecl and maxima installation
I tried 2 other binaries from different locations, but the problem remains. I noted from kcrisman's response that I have no '/usr/include/sys/' directory, so maybe this problem comes with Xcode? On Tuesday, November 18, 2014 11:07:56 AM UTC+8, Nils Bruin wrote: On Monday, November 17, 2014 5:49:14 PM UTC-8, Bozh wrote: ;;; (RUN-PROGRAM gcc (-I. -I/Applications/sage/local/lib/ecl/ -I/Users/buildslave-sage/slave/sage_git/build/local/include -I/Users/buildslave-sage/slave/sage_git/build/local/include -g -O2 -fPIC -fno-common -Ddarwin -O2 -c /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001IqKQ2b.c -o /private/var/folders/gh/26025ywx7w128zfds279s_9rgn/T/ecl001IqKQ2b.o)) Condition of type: UNBOUND-VARIABLE The variable C::GAZONK is unbound. You probably downloaded a binary? By the looks of it, ecl has some paths hard-baked into it: -I/Users/buildslave-sage/slave/sage_git/build/local/include. That path probably doesn't exist on your computer, but it was present on the mac on which the binary was built. Compilation would probably fail anyway, because you probably don't have a gcc that is compatible with the rest of the build (I assume we're not shipping gcc with our binary). The odd thing is that maxima deems it necessary to compile itself. Your binary should have a precompiled maxima available already. Something must have gotten damaged or the binary distribution from which you started is broken/incompatible with your OSX. First thing to try might be to try and install a fresh binary if you haven't done so already. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: simple 'solve' error, possibly related to ecl and maxima installation
Problem solved. I did not install 'Command Line Tools for Xcode' previously on my Mac because I did not read instructions on installing Sage from source code. After installing Command Line Tools, it works now. Though the installation of Sage is still from a binary one. @Nils and @kcrisman, thanks again for all your help. On Tuesday, November 18, 2014 10:10:39 AM UTC+8, kcrisman wrote: On Monday, November 17, 2014 8:49:14 PM UTC-5, Bozh wrote: I run the following code: $ sage -maxima And the messages are: Can you see what is in $ ls /usr/include/sys/ presumably types.h should be there. Did you download a binary? Can you say precisely which one you downloaded? It's possible that this one requires some developer headers or something, though that would be unfortunate. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Why solve(5^( x -1) == (0.04)^(2*x), x) returns empty set?
Le lundi 17 novembre 2014 17:32:27 UTC+1, Chris Seberino a écrit : If you ask Sage to do something it can't, like solve a quintic polynomial equation, it will spit the question back at you. If Sage did that I'd be fine. However, Sage spit back the empty set which is the WRONG answer and far different yes? That weakness of sage's (maxima's, indeed) is well known. In maxima, an alternative solver (%solve, a. k. a. to_poly_solve) is available, that sage can use through the to_poly_solve option of sage's solve : sage: solve(5^( x -1) == (1/25)^(2*x), x, to_poly_solve=True) [x == (2*I*pi*z54 + log(5))/log(3125)] which gives you also the set of complex solutions (log is multivalued in the complex plane...). Sage seems to have trouble finding that log(3125)=log(5^5)=5*log(5), which it can easily check. So substitute it by hand to get an expression easier to handle. HTH, -- Emmanuel Charpentier On Sunday, November 16, 2014 12:54:20 PM UTC-6, RRogers wrote: Apparently the default solver doesn't do logarithms. For the default try: solve(log(5^( x -1)) == log((0.04)^(2*x)), x) [x == 8104022*log(5)/(8104022*log(5) + 52171681)] -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.