sage

Solving a system of (more than two) linear inequalities

ε祈祈猫儿з 提交于 2019-12-07 13:59:31
问题 If I use diophantine(2*x+3*y-5*z-77) I receive this result. {(t_0, -9*t_0 - 5*t_1 + 154, -5*t_0 - 3*t_1 + 77)} Fine so far. However, on occasion one might like to constrain x, y and z to be (say) non-negative. When I use an approach like this< reduce_inequalities([0<=t_0, 0<=-9*t_0 - 5*t_1 + 154, 0<=-5*t_0 - 3*t_1 + 77],[t_0, t_1]) I get: NotImplementedError: inequality has more than one symbol of interest Does sympy, sage, prolog, haskell or some other freely available product have means for

Using Python's pickle in Sage results in high memory usage

我是研究僧i 提交于 2019-12-06 11:34:46
I am using the Python based Sage Mathematics software to create a very long list of vectors. The list contains roughly 100,000,000 elements and sys.getsizeof() tells me that it is of size a little less than 1GB. This list I pickle into a file (which already takes a long time -- but fair enough). Only when I unpickle this list it gets annoying. The RAM usage increases from 1.15GB to 4.3GB, and I am wondering what's going on? How can I find out in Sage what all the memory is used for? And do you have any ideas how to optimize this by maybe applying Python tricks? This is a reply to the comment

Solving a system of (more than two) linear inequalities

半世苍凉 提交于 2019-12-05 18:49:08
If I use diophantine(2*x+3*y-5*z-77) I receive this result. {(t_0, -9*t_0 - 5*t_1 + 154, -5*t_0 - 3*t_1 + 77)} Fine so far. However, on occasion one might like to constrain x, y and z to be (say) non-negative. When I use an approach like this< reduce_inequalities([0<=t_0, 0<=-9*t_0 - 5*t_1 + 154, 0<=-5*t_0 - 3*t_1 + 77],[t_0, t_1]) I get: NotImplementedError: inequality has more than one symbol of interest Does sympy, sage, prolog, haskell or some other freely available product have means for solving systems of linear inequalities that arise in this way. Thank you! To reason about integers in

IPython, Sage, Dependencies, Anaconda, and Package Integration?

不打扰是莪最后的温柔 提交于 2019-12-05 03:14:09
问题 I've just started using IPython for interactive development and exploratory research, which I've found really exciting with all the cool features and possibilities. I am using the Anaconda package manager to manage dependencies, which includes IPython. From what I've read, one goal of the IPython team is to eventually integrate Sage Math (CAS) into IPython, as a cell magic. Does anyone know if this is still under development? Or rather, if I wanted to use Sage now, is writing an extension the

Quadruple Precision Eigenvalues, Eigenvectors and Matrix Logarithms

…衆ロ難τιáo~ 提交于 2019-12-04 21:33:13
问题 I am attempting to diagonalize matrices in quadruple precision, and to take their logarithms. Is there a language in which I can accomplish this using built-in functions? Note, the languages/packages in the tags are insufficient, suffering from the following deficiencies: Matlab: Does not support quad precision. Python/NumPy/SciPy: Matrices with dtype float128 yield eigenvectors in float64. Sage: Interface through GP/PARI yields cryptic error messages. Has anyone performed diagonalization and

面试宝典系列-mysql面试基础题

隐身守侯 提交于 2019-12-04 10:01:57
1、char、varchar的区别是什么? varchar是变长而char的长度是固定的。如果你的内容是固定大小的,char的性能会更好。 2、tinyint、smallint、int、bigint,float、double占用字节数? tinyint:1个字节 smallint:2个字节,int:4个字节,bigint:8个字节 float:4个字节,double:8个字节 3、varchar(50)和varchar(100)的区别 varchar(50)最多存储50个字节,varchar(100)最多存储100个字节,存储hello字符串所占的内存是一样的,但后者在排序时会消耗更多内存。 4、int(20)中20的含义 是指显示字符的长度,不影响内部存储,只是当定义了ZEROFILL时,前面补多少个 0 5、以下语句是否会应用索引:SELECT * FROM users WHERE YEAR(adddate) < 2007; 不会,因为条件中使用运算,就不能使用索引了 6、一个6亿的表a,一个3亿的表b,通过外键tid关联,你如何最快的查询出满足条件的第50000到第50200中的这200条数据记录。 情况一:如果A表TID是自增长,并且是连续的,B表的ID为索引 select * from a,b where a.tid = b.id and a.tid>50000

IPython, Sage, Dependencies, Anaconda, and Package Integration?

泄露秘密 提交于 2019-12-03 16:36:26
I've just started using IPython for interactive development and exploratory research, which I've found really exciting with all the cool features and possibilities. I am using the Anaconda package manager to manage dependencies, which includes IPython. From what I've read, one goal of the IPython team is to eventually integrate Sage Math (CAS) into IPython, as a cell magic. Does anyone know if this is still under development? Or rather, if I wanted to use Sage now, is writing an extension the only way to do this [1]? [1] https://github.com/ipython/ipython/wiki/Extensions-Index Also, if I

What is the difference between SymPy and Sage?

蹲街弑〆低调 提交于 2019-12-03 03:41:40
问题 What is the difference between SymPy and Sage a.k.a. SageMath? 回答1: (Full disclosure: I am the lead developer of SymPy) The first thing you should understand is that SymPy and Sage are not quite the same thing. SymPy is a pure Python library, that does computer algebra. Sage is a collection of open source mathematical software. Sage tries to gather together all the major open source mathematics software, and glue it together into a useful system. In fact, Sage includes SymPy as one of its

What is the difference between SymPy and Sage?

孤者浪人 提交于 2019-12-02 17:07:40
What is the difference between SymPy and Sage a.k.a. SageMath? (Full disclosure: I am the lead developer of SymPy) The first thing you should understand is that SymPy and Sage are not quite the same thing. SymPy is a pure Python library, that does computer algebra. Sage is a collection of open source mathematical software. Sage tries to gather together all the major open source mathematics software, and glue it together into a useful system. In fact, Sage includes SymPy as one of its systems. Here is a short list of (biased) facts for each (I won't call them pros or cons, just facts): SymPy

An algorithm for randomly generating integer partitions of a particular length, in Python?

ぐ巨炮叔叔 提交于 2019-11-30 20:32:38
I've been using the random_element() function provided by SAGE to generate random integer partitions for a given integer ( N ) that are a particular length ( S ). I'm trying to generate unbiased random samples from the set of all partitions for given values of N and S . SAGE's function quickly returns random partitions for N (i.e. Partitions(N).random_element() ). However, it slows immensely when adding S (i.e. Partitions(N,length=S).random_element() ). Likewise, filtering out random partitions of N that are of length S is incredibly slow. However, and I hope this helps someone, I've found