sage

Jupyter does not run with sagemath installed

风格不统一 提交于 2020-01-07 05:50:08
问题 I am running on a mac, with sagemath installed and Anaconda also. Sage is working fine, though Jupyter notebook doesn't run. I get the following error: Rois-MBP:~ roi$ /anaconda/bin/jupyter_mac.command ; exit; [W 22:32:09.192 NotebookApp] Unrecognized JSON config file version, assuming version 1 Traceback (most recent call last): File "/anaconda/bin/jupyter-notebook", line 6, in <module> sys.exit(notebook.notebookapp.main()) File "//anaconda/lib/python3.5/site-packages/jupyter_core

Error on running Sage

北城以北 提交于 2020-01-05 07:16:11
问题 I am trying to use Sage but when I type ./sage I get a lot of errors like these, with strange characters: ---------------------------------------------------------------------- | Sage Version 4.8, Release Date: 2012-01-20 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- /mnt/dados/sage-4.8-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/local/bin/python: 1: ELF: not found /mnt/dados/sage-4.8-linux-64bit-ubuntu

Multivariate polynomial division in sage

跟風遠走 提交于 2020-01-02 10:02:29
问题 I try to do a simple division of polynomials in two variables using sage. Unfortunately, I get an unexpected result, as is illustrated in the code below. I tried several different ways to instantiate the ring and its variables, but the result stays the same. Using the %-operator to get a rest of a division yields the same results. Any ideas? R, (x, y) = PolynomialRing(RationalField(), 2, 'xy').objgens() t = x^2*y^2 + x^2*y - y + 1 f1 = x*y^2 + x f2 = x*y - y^3 (q, r) = t.quo_rem(f1) print

Multivariate polynomial division in sage

谁都会走 提交于 2020-01-02 10:02:01
问题 I try to do a simple division of polynomials in two variables using sage. Unfortunately, I get an unexpected result, as is illustrated in the code below. I tried several different ways to instantiate the ring and its variables, but the result stays the same. Using the %-operator to get a rest of a division yields the same results. Any ideas? R, (x, y) = PolynomialRing(RationalField(), 2, 'xy').objgens() t = x^2*y^2 + x^2*y - y + 1 f1 = x*y^2 + x f2 = x*y - y^3 (q, r) = t.quo_rem(f1) print

Unsized object error with numpy.random.permutation?

百般思念 提交于 2020-01-02 07:06:10
问题 I have some code right now that is getting stuck on one line: perm = numpy.random.permutation(128) To which it give the following error: "TypeError: len() of unsized object." I can't figure out what the issue is since 128 is just an integer. I see that this is a problem that has probably been resolved before here: http://mail.scipy.org/pipermail/numpy-discussion/2007-January/025592.html but their solution isn't helpful to me since it is about floats. Can anyone see what's going wrong here?

MongoDB Java 操作

北战南征 提交于 2019-12-27 12:06:28
1. 编写 Java 代码连接 MongoDB 数据库。 2. 编写 Java 代码在 MongoDB 中创建集合。 3. 编写 Java 代码在 MongoDB 中获取集合。 4. 编写 Java 代码在 MongoDB 中插入文档。 5. 编写 Java 代码在 MongoDB 中检索所有文档。 6. 编写 Java 代码在 MongoDB 中更新文档。 7. 编写 Java 代码在 MongoDB 中删除文档。 package DBtest; import java.util.ArrayList; import java.util.List; import org.bson.Document; import com.mongodb.MongoClient; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoCursor; import com.mongodb.client.MongoDatabase; import com.mongodb.client.model.Filters; public class TestMongoDB { /** * @param args */ public static void main(String[] args) { // insert()

How to properly evaluate sage code from within a Python script

不羁岁月 提交于 2019-12-24 19:49:53
问题 I've been trying to evaluate a simple "integrate(x,x)" statement from within Python, by following the Sage instructions for importing Sage into Python. Here's my entire script: #!/usr/bin/env sage -python from sage.all import * def main(): integrate(x,x) pass main() When I try to run it from the command line, I get this error thrown: NameError: global name 'x' is not defined I've tried adding var(x) into the script, global x , tried replacing integrate(x,x) with sage.integrate(x,x) , but I

ImportError: No module named _scproxy

本秂侑毒 提交于 2019-12-24 11:27:42
问题 I tried to make Sage from the source but I failed. It seems that the library _scproxy is missing on Yosemite. I haven't found a very helpful aid here on SO and everywhere on the net. If someone can help me. Here is the log : Found local metadata for setuptools-12.4 Found local sources at /Users/sam/Downloads/sage-6.7/upstream/setuptools-12.4.tar.gz Checksum: 427e916ad99a704af54b7aa3124bd52d4ebf04d3 vs 427e916ad99a704af54b7aa3124bd52d4ebf04d3 setuptools-12.4 ===================================

Solving simultaneous equations in Sage

萝らか妹 提交于 2019-12-23 04:26:42
问题 In Sage (using the Sage terminal in Sage Cloud), I expected the following to yield the result [t == (1/2)] . However, it yields the result [] . sage: var('x1 y1 x2 y2 t') (x1, y1, x2, y2, t) sage: eq1 = x1==t sage: eq2 = y1==t sage: eq3 = x2==t sage: eq4 = y2==1-t sage: solve([eq1,eq2,eq3,eq4,x1==x2,y1==y2],t) [] The following reformulation doesn't help: sage: eq5 = x1==x2 sage: eq6 = y1==y2 sage: solve([eq1,eq2,eq3,eq4,eq5,eq6],t) [] Where am I going wrong? 回答1: If you write solve([eq1,eq2

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

时光毁灭记忆、已成空白 提交于 2019-12-22 17:50:11
问题 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