Ask Your Question

araichev's profile - activity

2023-10-18 16:34:56 +0100 received badge  Notable Question (source)
2023-10-18 16:34:56 +0100 received badge  Popular Question (source)
2021-07-01 09:44:14 +0100 received badge  Famous Question (source)
2020-08-06 02:23:18 +0100 received badge  Notable Question (source)
2020-08-06 02:23:18 +0100 received badge  Popular Question (source)
2020-04-27 10:07:18 +0100 received badge  Famous Question (source)
2020-03-12 14:25:03 +0100 received badge  Famous Question (source)
2020-03-03 20:20:27 +0100 received badge  Famous Question (source)
2020-02-18 05:18:52 +0100 received badge  Famous Question (source)
2019-07-08 15:08:34 +0100 received badge  Notable Question (source)
2019-07-08 15:08:34 +0100 received badge  Popular Question (source)
2019-04-28 09:26:04 +0100 received badge  Notable Question (source)
2019-04-28 09:26:04 +0100 received badge  Popular Question (source)
2018-09-11 18:31:36 +0100 received badge  Popular Question (source)
2018-06-07 12:49:02 +0100 received badge  Notable Question (source)
2016-01-23 16:33:52 +0100 received badge  Notable Question (source)
2015-11-05 18:53:37 +0100 received badge  Popular Question (source)
2015-11-05 18:53:37 +0100 received badge  Notable Question (source)
2015-10-29 03:55:13 +0100 received badge  Good Answer (source)
2015-10-29 03:55:13 +0100 received badge  Enlightened (source)
2015-10-23 04:44:18 +0100 received badge  Famous Question (source)
2015-08-27 11:41:31 +0100 received badge  Famous Question (source)
2015-05-13 02:38:30 +0100 received badge  Famous Question (source)
2015-03-27 04:12:03 +0100 marked best answer partial fraction decomposition function for multivariate rational expressions

Hi all:

I'd like to extend Sage's partial fraction decomposition function in the QuotientField class to a function that works on quotients of multivariate polynomials. To this end, i've found it convenient to store a rational expression $F = P/(Q_1^{e_1} \cdots Q_m^{e_m})$ as a Python list of the form [P,[Q_1,e_1],...,[Q_m,e_m]], where $Q_1,\ldots,Q_m$ are the irreducible factors of $F$'s denominator. Let's call these special kinds of lists 'widgets'. I have several auxiliary functions that manipulate widgets.

Code design questions for you. Should i make a new class for widgets, and if so, where in the Sage tree of modules should i put this class? If not, where do i put the auxiliary functions that manipulate widgets?

Thanks for your attention.

Alex

2015-03-27 04:11:52 +0100 marked best answer How to add string tick labels to 2D plots?

Hi folks, i want to add string tick labels to a 2D plot, e.g. ['$100', '$200', '$300'] on the x-axis instead of the ticks [1, 2, 3]. I see from http://stackoverflow.com/questions/5439708/python-matplotlib-creating-date-ticks-from-string that i can do this with matplotlib via

from matplotlib import pyplot as plt
plt.plot([1,2,3],[3,4,3])
ax = plt.gca()
ax.set_xticks([1,2,3])
ax.set_xticklabels(['$100','$200','$300'])

Is there a Sage way to accomplish the same thing?

Personally, i find Sage plotting commands more user-friendly than matplotlib commands.

2015-03-27 04:11:51 +0100 marked best answer can't create Sage clone

Hi all:

I just tried to create a Sage 4.6 sandbox to start writing patches with but got some apparently fatal errors running Mac OS 10.6 with the latest version of Xcode installed. Any suggestions?

Alex

raichev@wujarch-l/Applications/sage> ./sage -clone dabble
Now cloning the current Sage library branch...
hg clone  sage sage-dabble 
updating working directory
2339 files updated, 0 files merged, 0 files removed, 0 files unresolved
Copying over all Cython auto-generated .c, .cpp and .h files...
Copying over build directory...
Copying over all auto-generated reference manual .rst files...
Copying over documentation output...
Building sage-dabble...
sage -b dabble

----------------------------------------------------------
sage: Building and installing modified Sage library files.


Installing c_lib
gcc -o src/convert.os -c -fPIC -I/Applications/sage/local/include -I/Applications/sage/local/include/python2.6 -I/Applications/sage/local/include/NTL -Iinclude src/convert.c
In file included from include/convert.h:12:0,
                 from src/convert.c:14:
/Applications/sage/local/include/pari/pari.h:20:47: fatal error: stdlib.h: No such file or directory
compilation terminated.
scons: *** [src/convert.os] Error 1
ERROR: There was an error building c_lib.


real    0m0.848s
user    0m0.281s
sys 0m0.224s
Error building Sage

After cloning, if you change any Sage library files and want to rebuild
the html version of the reference manual, use the command
    sage -docbuild reference html
(after running 'sage -b').

Note: if *before* cloning, you have changed any Sage library files
without rebuilding the reference manual, then after cloning, you
will need to touch those files again if you want the changes
to be incorporated into the reference manual.

Updating modification times for the documentation...
sage -docbuild --update-mtimes reference html
Warning: Could not import sage.combinat.words.morphism dlopen(/Applications/sage/local/lib/python2.6/site-packages/sage/rings/memory.so, 2): Library not loaded: libcsage.dylib
  Referenced from: /Applications/sage/local/lib/python2.6/site-packages/sage/rings/memory.so
  Reason: image not found
Warning: Could not import sage.crypto.block_cipher.miniaes dlopen(/Applications/sage/local/lib/python2.6/site-packages/sage/rings/memory.so, 2): Library not loaded: libcsage.dylib
  Referenced from: /Applications/sage/local/lib/python2.6/site-packages/sage/rings/memory.so
  Reason: image not found

[lots of the same and then...]

sphinx-build -b html -d /Applications/sage/devel/sage/doc/output/doctrees/en/reference    /Applications/sage/devel/sage/doc/en/reference /Applications/sage/devel/sage/doc/output/html/en/reference
Traceback (most recent call last):
  File "/Applications/sage/local/bin/sphinx-build", line 6, in <module>
    import sage.all
  File "/Applications/sage/local/lib/python2.6/site-packages/sage/all.py", line 56, in <module>
    from sage.rings.memory import pmem_malloc
ImportError: dlopen(/Applications/sage/local/lib/python2.6/site-packages/sage/rings/memory.so, 2): Library not loaded: libcsage.dylib
  Referenced from: /Applications/sage/local/lib/python2.6/site-packages/sage/rings/memory.so
  Reason: image not found
Build finished.  The built documents can be found in /Applications/sage/devel/sage/doc/output/html/en/reference
*** WARNING ***
If you are cloning ...
(more)
2015-03-27 04:11:44 +0100 marked best answer Sage 5.5 + OS Mountain Lion + Chrome or Firefox or Safari -> interactive 3d plotting fail

Hi all, i'm running Sage 5.5 with Apple OS Mountain Lion. Running a Sage notebook on Chrome, Firefox, or Safari, i can't get Jmol to make my 3d plots interactive. When i click the 'make interactive' button, i get a 'missing plug-in' error link which refers me to this Java page to download Java 7. Do i really need Java 7 to make 3d plots interactive? I ask, because the java download page has this warning:

If you download Java 7, you will not be able to run Java content in Chrome and will need to use a 
64-bit browser (such as Safari or Firefox) to run Java content within a browser. Additionally, 
installing Java 7 will disable the ability to use Apple Java 6 on your system.

By the way, i did not have this problem with Sage 5.4 and Apple OS Lion.

2015-03-27 04:10:26 +0100 marked best answer Add text to Tachyon image?

Hi folks, is there a way to add text to Tachyon images? I tried

S = sphere(opacity=0.8, aspect_ratio=[1,1,1])
T = text3d('hello world', (2,2,2))
M = S + T
M.show(viewer='tachyon', frame=False)

in the Sage notebook, but that didn't work. Got a sphere but no text. I also searched the docs, but couldn't find anything relevant.

2015-03-27 04:08:51 +0100 marked best answer can't create Sage clone again

Hi all:

Do you know what's up with this?

~> sage -clone araichev
Now cloning the current Sage library branch...
hg clone  sage sage-araichev 
abort: data/.hgtags.i@73558cfaae3a: no match found!
Error cloning

real    0m1.219s
user    0m0.179s
sys 0m0.311s

I'm using Sage 5.3 on a mid-2011 Apple iMac 2.5 GHz Intel Core i5 running OS 10.7.4.

Thanks.

2015-03-27 04:08:42 +0100 marked best answer from sage.numerical import optimize, fail

Hi all, what did i do wrong?

> sage -version
Sage Version 4.8, Release Date: 2012-01-20
> sage -python
Python 2.6.4 (r264:75706, Jan 20 2012, 01:12:14) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sage.numerical import optimize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/sage/local/lib/python2.6/site-packages/sage/numerical/__init__.py", line 1, in <module>
import all
File "/Applications/sage/local/lib/python2.6/site-packages/sage/numerical/all.py", line 1, in <module>
from optimize import (find_root, find_maximum_on_interval,
File "/Applications/sage/local/lib/python2.6/site-packages/sage/numerical/optimize.py", line 13, in <module>
from sage.modules.free_module_element import vector
File "integer.pxd", line 9, in init sage.modules.free_module_element (sage/modules/free_module_element.c:27684)
File "integer.pyx", line 171, in init sage.rings.integer (sage/rings/integer.c:35507)
File "/Applications/sage/local/lib/python2.6/site-packages/sage/rings/infinity.py", line 200, in <module>
import sage.rings.rational
File "fast_arith.pxd", line 3, in init sage.rings.rational (sage/rings/rational.c:25818)
File "fast_arith.pyx", line 51, in init sage.rings.fast_arith (sage/rings/fast_arith.c:7675)
File "integer_ring.pyx", line 69, in init sage.rings.integer_ring (sage/rings/integer_ring.c:11264)
File "/Applications/sage/local/lib/python2.6/site-packages/sage/structure/factorization.py", line 188, in <module>
from sage.misc.all import prod
File "/Applications/sage/local/lib/python2.6/site-packages/sage/misc/all.py", line 81, in <module>
from functional import (additive_order,
File "/Applications/sage/local/lib/python2.6/site-packages/sage/misc/functional.py", line 36, in <module>
from sage.rings.complex_double import CDF
File "complex_double.pyx", line 88, in init sage.rings.complex_double (sage/rings/complex_double.c:15116)
File "real_mpfr.pxd", line 15, in init sage.rings.complex_number (sage/rings/complex_number.c:16522)
File "real_mpfr.pyx", line 1, in init sage.rings.real_mpfr (sage/rings/real_mpfr.c:30362)
File "utils.pyx", line 11, in init sage.libs.mpmath.utils (sage/libs/mpmath/utils.c:6059)
File "/Applications/sage/local/lib/python2.6/site-packages/sage/all.py", line 72, in <module>
from sage.libs.all       import *
File "/Applications/sage/local/lib/python2.6/site-packages/sage/libs/all.py", line 1, in <module>
import sage.libs.ntl.all  as ntl
File "/Applications/sage/local/lib/python2.6/site-packages/sage/libs/ntl/__init__.py", line 1, in <module>
import all
File "/Applications/sage/local/lib/python2.6/site-packages/sage/libs/ntl/all.py", line 26, in <module>
from sage.libs.ntl.ntl_ZZ import (
File "ntl_ZZ.pyx", line 28, in init sage.libs.ntl.ntl_ZZ (sage/libs/ntl/ntl_ZZ.cpp:6353)
File "integer_ring.pyx", line 1063, in sage.rings.integer_ring.IntegerRing (sage/rings/integer_ring.c:9806)
NameError: ZZ
2015-03-27 04:07:37 +0100 marked best answer rounding bug?

Hi all:

In a notebook window i tell Sage

w = 0.4 
while w > 0.1:    
    w = w - 0.1 
    print w 
print w==0

and it outputs

0.3000000000000000
0.200000000000000
0.100000000000000
2.77555756156289e-17
False

Is this supposed to happen?

Thanks for your attention. Alex

2015-03-27 04:06:59 +0100 marked best answer How to import prod()?

Hi all:

I'm adding code to sage.categories.quotient_fields.py and need to call upon the prod() function. Apparently i need to import it. How do i do that? I can't find out where it's located in the Sage file system.

2015-01-13 22:42:39 +0100 received badge  Famous Question (source)
2015-01-13 07:19:18 +0100 received badge  Notable Question (source)
2014-12-14 04:08:51 +0100 received badge  Popular Question (source)
2014-10-24 02:16:45 +0100 received badge  Notable Question (source)
2014-06-29 18:23:50 +0100 received badge  Famous Question (source)
2014-06-29 18:23:50 +0100 received badge  Notable Question (source)
2014-06-29 18:23:50 +0100 received badge  Popular Question (source)
2014-06-29 03:15:12 +0100 marked best answer Changing the vertex shape for combinatorial graphs

Hi all:

Given a combinatorial graph (the nodes and edges type) $g$, what are the valid vertex_shape options for g.plot()? I can't find them in the Sage reference manual. I want to make square vertices.

Thanks.

2014-06-29 03:15:12 +0100 marked best answer How to plot generic graphs without nodes overlapping

Hi all:

Regarding generic graphs (the nodes and edges type), is there a way to plot them without the nodes overlapping? Some node_overlap=False option?

2014-06-29 03:15:09 +0100 marked best answer Import problem

Hi all:

I'm editing sage.categories.quotient_fields and trying to import the algebraic_dependence() function. When i do so by inserting

from sage.rings.polynomial.multi_polynomial_sequence import algebraic_dependence

at the top of the file, saving, and rebuilding Sage, i get the following error when starting Sage. Is it some kind of circular importing problem?

AttributeError                            Traceback (most recent call last)

/Applications/sage/local/lib/python2.6/site-packages/IPython/ipmaker.pyc in     force_import(modname, force_reload)
 61         reload(sys.modules[modname])
 62     else:
---> 63         __import__(modname)
 64         
 65 

/Applications/sage/local/bin/ipy_profile_sage.py in <module>()
  5     preparser(True)
  6     
----> 7     import sage.all_cmdline
  8     sage.all_cmdline._init_cmdline(globals())
  9     

/Applications/sage/local/lib/python2.6/site-packages/sage/all_cmdline.py in <module>()
 12 try:
 13 
---> 14     from sage.all import *
 15     from sage.calculus.predefined import x
 16     preparser(on=True)

/Applications/sage/local/lib/python2.6/site-packages/sage/all.py in <module>()
 66 from time                import sleep
 67 
---> 68 from sage.misc.all       import *         # takes a while
 69 
 70 from sage.misc.sh import sh

/Applications/sage/local/lib/python2.6/site-packages/sage/misc/all.py in <module>()
 79 from func_persist import func_persist
 80 
---> 81 from functional import (additive_order,
 82                         sqrt as numerical_sqrt,
 83                         arg,

/Applications/sage/local/lib/python2.6/site-packages/sage/misc/functional.py in <module>()
 34 
 35 
---> 36 from sage.rings.complex_double import CDF
 37 from sage.rings.real_double import RDF, RealDoubleElement
 38 

/Applications/sage/local/bin/integer.pxd in init sage.rings.complex_double (sage/rings/complex_double.c:15016)()
  7 
  8 
----> 9 
 10 
 11 

/Applications/sage/local/bin/integer.pyx in init sage.rings.integer (sage/rings/integer.c:35507)()
169 
170 
--> 171 
172 
173 

/Applications/sage/local/lib/python2.6/site-packages/sage/rings/infinity.py in <module>()
198 #import sage.rings.real_mpfr
199 import sage.rings.integer
--> 200 import sage.rings.rational
201 
202 from sage.rings.integer_ring import ZZ

/Applications/sage/local/bin/fast_arith.pxd in init sage.rings.rational (sage/rings/rational.c:25818)()
  1 
  2 
----> 3 
  4 
  5 

/Applications/sage/local/bin/fast_arith.pyx in init sage.rings.fast_arith (sage/rings/fast_arith.c:7675)()
 49 
 50 
---> 51 
 52 
 53 

/Applications/sage/local/bin/integer_ring.pyx in init sage.rings.integer_ring (sage/rings/integer_ring.c:11235)()
 65 
 66 
---> 67 
 68 
 69 

/Applications/sage/local/lib/python2.6/site-packages/sage/rings/rational_field.py in <module>()
914         
915 
--> 916 QQ = RationalField()
917 Q = QQ
918 

/Applications/sage/local/lib/python2.6/site-packages/sage/rings/rational_field.py in __init__(self)
210             ('x',)
211         """
--> 212         from sage.categories.basic import QuotientFields
213         ParentWithGens.__init__(self, self, category = QuotientFields())
214         self._assign_names(('x',),normalize=False) # ???

/Applications/sage/local/lib/python2.6/site-packages/sage/categories/basic.py in <module>()
 46 
 47 from fields import Fields
---> 48 from quotient_fields import QuotientFields
 49 from finite_fields import FiniteFields
 50 

/Applications/sage/local/lib/python2.6/site-packages/sage/categories/quotient_fields.py in <module>()
 13 from sage.misc.abstract_method import abstract_method
 14 from sage.misc.misc_c import prod
---> 15 from sage.rings.polynomial.multi_polynomial_sequence import algebraic_dependence ...
(more)
2014-06-29 03:15:08 +0100 marked best answer method overloading error?

Hi all:

I made a class called RationalExpression that encodes a rational expression (ratio of polynomials). It contains a class method called 'numerator' that returns the numerator of a RationalExpression instance, but the method doesn't work when i work with a multivariate polynomial ring. The 'numerator' method appears to clash with another 'numerator' method. Do you know how i can fix my bug?

Here's the relevant code snippet from /Users/arai021/Dropbox/sage_projects/pfd.py:

class RationalExpression(object):
    r"""
    Represents a rational expression `P/(Q_1^e_1 \cdots Q_m^e_m)` by storing the
    parts `P` and `[[Q_1,e_1], \ldots, [Q_m,e_m]]`, where
   `P, Q_1, \ldots, Q_m` are elements of a common polynomial ring, and
   `e_1, \ldots, e_m` are positive integers.
    """
    def __init__(self, num, *denoms):
        self.numerator = num
        self.base_ring = num.parent() 
        self.denominators = sorted(denoms) 

    def __str__(self):
        return str([self.numerator, self.denominators])

    def numerator(self):
        return self.numerator

And here's a failing example:

sage: attach("/Users/arai021/Dropbox/sage_projects/pfd.py")
sage: R.<x,y>= PolynomialRing(QQ)
sage: P = x*y**2
sage: Qs = [x*y,3], [x,1]
sage: f = RationalExpression(P, *Qs)
sage: print f
[x*y^2, [[x, 1], [x*y, 3]]]
sage: type(f)
<class '__main__.RationalExpression'>
sage: f.numerator()
Traceback (most recent call last):    print f
  File "", line 1, in <module>

  File "/private/var/folders/bc/bc2aJOjCE20MqpWiFIh58++++TQ/-Tmp-/tmpcbitNd/___code___.py", line 10, in <module>
    exec compile(u'print f.numerator()' + '\n', '', 'single')
  File "", line 1, in <module>

  File "multi_polynomial_libsingular.pyx", line 2025, in     sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.__call__ (sage/rings/polynomial/multi_polynomial_libsingular.cpp:14808)
TypeError: number of arguments does not match number of variables in parent
2014-06-29 03:15:08 +0100 marked best answer polynomial ring instance check

Hi there, folks. How do i check if something is an instance of a polynomial ring (univariate or multivariate)?