Ask Your Question

Will Orrick's profile - activity

2021-11-25 02:39:27 +0100 received badge  Popular Question (source)
2021-11-25 02:37:49 +0100 received badge  Popular Question (source)
2021-10-31 15:14:00 +0100 received badge  Enthusiast
2021-09-21 05:10:36 +0100 edited answer Unable to link Jupyter notebook to correct kernel

The fix I found was to remove the folder sagemath from the following folder: /Users/williamorrick2/Library/Jupyter/kern

2021-09-21 05:06:25 +0100 marked best answer Unable to link Jupyter notebook to correct kernel

A while ago I installed sage version 9.1 on my MacBook Pro running MacOS Mojave 10.14.6. That installation was from binary and was made in the MacOS Applications folder. Today I tried to install sage version 9.4, compiling from source. The install was in a subfolder of my user folder. The install seems fine, and I am able to run sage 9.4 from the command line.

Now I am trying to run 9.4 in a Jupyter notebook. After typing

./sage -n jupyter

or

./sage -n jupyterlab

in the root directory of my new installation things start well—the following banner comes up in the terminal,

┌────────────────────────────────────────────────┐
│ SageMath version 9.4, Release Date: 2021-08-22 │
│ Using Python 3.9.5. Type "help()" for help.    │
└────────────────────────────────────────────────┘
Please wait while the Jupyterlab server starts...
[I 18:26:42.688 LabApp] JupyterLab extension loaded from /Users/williamorrick2/sage- 9.4/local/lib/python3.9/site-packages/jupyterlab
[I 18:26:42.688 LabApp] JupyterLab application directory is /Users/williamorrick2/sage-9.4/local/share/jupyter/lab
[I 18:26:42.694 LabApp] Serving notebooks from local directory: /Users/williamorrick2/sage-9.4
[I 18:26:42.694 LabApp] Jupyter Notebook 6.1.1 is running at:
[I 18:26:42.694 LabApp] http://localhost:8888/?token=ba7dda9e8563ac920c9dd6ae2ab402980df04273ce90c616
[I 18:26:42.694 LabApp]  or http://127.0.0.1:8888/?token=ba7dda9e8563ac920c9dd6ae2ab402980df04273ce90c616
[I 18:26:42.694 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:26:42.704 LabApp] 

    To access the notebook, open this file in a browser:
        file:///Users/williamorrick2/Library/Jupyter/runtime/nbserver-2218-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=ba7dda9e8563ac920c9dd6ae2ab402980df04273ce90c616
     or http://127.0.0.1:8888/?token=ba7dda9e8563ac920c9dd6ae2ab402980df04273ce90c616
[I 18:26:45.498 LabApp] Build is up to date
[I 18:26:45.750 LabApp] Kernel started: 8500f3e9-4730-4c6d-8363-5686721acc8e, name: sagemath

—but when the notebook opens (either in Jupyter notebook or in Jupyterlab) the kernel is sage 9.1 rather than 9.4. Furthermore I am unable to execute any code. In the terminal, immediately following the lines quoted above, I get a bunch of messages like

> /Applications/SageMath-9.1.app/Contents/Resources/sage/local/bin/sage: line 619: /Users/williamorrick2/sage-9.4/local/bin/python2: No such file or directory

which suggest that Jupyter is running the old kernel in the Applications folder, and that it is looking for python2 under my new installation, which only contains python3.

How do I go about correcting this?

2021-09-20 01:28:11 +0100 received badge  Nice Answer (source)
2021-09-19 04:03:15 +0100 commented question Unable to link Jupyter notebook to correct kernel

Thinking about this some more, perhaps it makes sense. I started up sage 9.4 in my local user directory, which then star

2021-09-19 00:29:38 +0100 commented question Jupyter notebook slow to load and unresponsive

Update: I upgraded from jupyter-notebook 5.7.6 to jupyter-notebook 6.1.1 and still just as slow. Will try to find time t

2021-09-19 00:23:16 +0100 edited answer Unable to link Jupyter notebook to correct kernel

The fix I found was to remove the folder sagemath from the following folder: /Users/williamorrick2/Library/Jupyter/kern

2021-09-19 00:22:27 +0100 commented question Unable to link Jupyter notebook to correct kernel

My problem has been solved--see my answer and the better answer of Masacroso--but one mystery remains, namely why my sag

2021-09-18 16:40:23 +0100 commented answer Unable to link Jupyter notebook to correct kernel

Thanks. The install part wouldn't have been necessary in my case because the sage installation takes care of that. But "

2021-09-18 09:12:38 +0100 received badge  Self-Learner (source)
2021-09-18 09:12:38 +0100 received badge  Teacher (source)
2021-09-18 04:52:22 +0100 edited question Unable to link Jupyter notebook to correct kernel

Unable to link Jupyter notebook to correct kernel A while ago I installed sage version 9.1 on my MacBook Pro running Mac

2021-09-18 00:57:01 +0100 answered a question Unable to link Jupyter notebook to correct kernel

The fix I found was to remove the folder sagemath from the following folder: /Users/williamorrick2/Library/Jupyter/kern

2021-09-17 12:55:03 +0100 edited question Unable to link Jupyter notebook to correct kernel

Unable to link Jupyter notebook to correct kernel A while ago I installed sage version 9.1 on my MacBook Pro running Mac

2021-09-17 12:51:54 +0100 received badge  Commentator
2021-09-17 12:51:54 +0100 commented answer Unable to link Jupyter notebook to correct kernel

Thanks for your message. In my old installation I never ran sage from the command line--I had a sage icon in my dock and

2021-09-17 12:40:22 +0100 edited question Unable to link Jupyter notebook to correct kernel

Unable to link Jupyter notebook to correct kernel A while ago I installed sage version 9.1 on my MacBook Pro running Mac

2021-09-17 01:47:10 +0100 commented question Jupyter notebook slow to load and unresponsive

@rburing Thanks for trying to reproduce the issue and for your suggestions. I'm trying a new version of sage (which cont

2021-09-17 01:44:30 +0100 commented question Jupyter notebook slow to load and unresponsive

@EmmanuelCharpentier I think I now have a more precise description of my problem, but no real diagnosis that might be he

2021-09-17 01:35:47 +0100 asked a question Unable to link Jupyter notebook to correct kernel

Unable to link Jupyter notebook to correct kernel A while ago I installed sage version 9.1 on my MacBook Pro running Mac

2021-09-16 13:48:22 +0100 received badge  Nice Question (source)
2021-09-16 04:51:18 +0100 edited question Jupyter notebook slow to load and unresponsive

Jupyter notebook slow to load and unresponsive At some point one of my SageMath Jupyter notebooks became very slow to re

2021-09-16 03:55:31 +0100 commented question Jupyter notebook slow to load and unresponsive

I'm not doing any LaTeX rendering - just plain text. It's funny because notebooks of ten times the file size with lots o

2021-09-15 04:51:54 +0100 commented question Jupyter notebook slow to load and unresponsive

Thanks for this suggestion. I have started to do this, and so far any differences are minor. I'm beginning to suspec, ho

2021-09-14 15:44:57 +0100 edited question Jupyter notebook slow to load and unresponsive

Jupyter notebook slow to load and unresponsive At some point one of my SageMath Jupyter notebooks became very slow to re

2021-09-14 15:44:19 +0100 asked a question Jupyter notebook slow to load and unresponsive

Jupyter notebook slow to load and unresponsive At some point one of my SageMath Jupyter notebooks became very slow to re

2021-08-31 00:57:55 +0100 edited question support() and coefficients() in combinatorial free modules

support() and coefficients() in combinatorial free modules I was surprised that in the code below I could not count on t

2021-08-29 23:06:13 +0100 commented question support() and coefficients() in combinatorial free modules

I should have tried expr.coefficients()? first, to see what help was available. This provides me with "'sort' -- (defaul

2021-08-29 23:01:38 +0100 commented answer support() and coefficients() in combinatorial free modules

Interesting that the behavior may be version or platform dependent. The dictionary method does seem to be the better way

2021-08-29 23:01:17 +0100 commented answer support() and coefficients() in combinatorial free modules

Interesting that the behavior may be version or platform dependent. The dictionary method does seem to be the better way

2021-08-29 22:57:32 +0100 commented question support() and coefficients() in combinatorial free modules

I should have tried expr.coefficients()? first, to see what help was available. This provides me with "'sort' -- (defaul

2021-08-29 22:57:16 +0100 commented question support() and coefficients() in combinatorial free modules

I should have tried expressions.coefficients()? first, to see what help was available. This provides me with "'sort' --

2021-08-29 22:20:58 +0100 commented question support() and coefficients() in combinatorial free modules

expr.monomial_coefficients() looks like the right approach; I've managed to use it to set up a sparse matrix and solve m

2021-08-29 05:02:37 +0100 asked a question support() and coefficients() in combinatorial free modules

support() and coefficients() in combinatorial free modules I was surprised that in the code below I could not count on t

2021-01-20 20:52:29 +0100 commented question Tensor product of elements of non-free algebras

Thanks. I've been trying (with difficulty) to follow the discussion there, and there seems to be some question about whether tensor() is even supposed to be defined on elements. I did find examples in the documentation here and here. But maybe it's not defined for every type of algebra? If not, is this something that is feasible for a user to define themselves?

2021-01-20 09:09:02 +0100 received badge  Nice Question (source)
2021-01-19 21:05:29 +0100 received badge  Editor (source)
2021-01-19 21:04:27 +0100 asked a question Tensor product of elements of non-free algebras

In SageMath 9.1 I am unable to execute the code

a = SteenrodAlgebra(2).an_element()
M = CombinatorialFreeModule(GF(2), 's,t,u')
s = M.basis()['s']
T = tensor([a,s])

which is copied verbatim from this answer posted back in 2012. Instead, I get AttributeError on the tensor command. Is there some ingredient I'm missing?

More to the point, I am unable to run

N = 2
k.<w> = CyclotomicField(N)

A.<X,Z> = FreeAlgebra(k, 2)
F = A.monoid()
X, Z = F.gens()

monomials = [X^i*Z^j for j in range(0,N) for i in range(0,N)]

MS = MatrixSpace(k, len(monomials))
matrices = [
    # matrix showing the action of the first generator, X, on the monomials
    MS([0, 1, 0, 0,    # 1*X = X
          1, 0, 0, 0,    # X*X = 1
          0, 0, 0, -1,   # Z*X = -XZ
          0, 0, -1, 0    # XZ*X = -Z
         ]),
    # matrix showing the action of the second generator, Z, on the monomials
    MS([0, 0, 1, 0,     # 1*Z = Z
          0, 0, 0, 1,    # X*Z = XZ
          1, 0, 0, 0,    # Z*Z = 1
          0, 1, 0, 0     # XZ*Z = X
         ]),
]
B.<X,Z> = A.quotient(monomials, matrices)

tensor( (X*Z,X) )

which is the code I'm actually interested in. In this instance I get AssertionError on the tensor command. Is there some restriction on using tensor on non-free algebras? The code below executes fine:

N = 3
k.<w> = CyclotomicField(N)

A.<X,Z> = FreeAlgebra(k, 2)

tensor( (X*Z,X) )
2021-01-08 17:39:18 +0100 commented answer tensor_product of matrices over cyclotomic field

Thanks for creating these tickets and for the sample code. I learned a lot about Python and Sage by studying them.

2021-01-08 17:38:06 +0100 marked best answer tensor_product of matrices over cyclotomic field

Beginner question: I have created some matrices over a cyclotomic field and attempted to compute some of their tensor products:

N = 3
k.<w> = CyclotomicField(N)
Z = diagonal_matrix(k,N,[w^j for j in range(0,N)])
X = matrix(k,N,N,[1 if (i%N - floor(i/N)) % N == N-1 else 0 for i in range(0,N*N)])
I = identity_matrix(k,N)
I.tensor_product(X)
X.tensor_product(I)
Z.tensor_product(I)
Z.tensor_product(X)

#I.tensor_product(Z)
#X.tensor_product(Z)

If I uncomment either of the last two lines I get

AttributeError: 'sage.matrix.matrix_generic_sparse.Matrix_generic_sparse' object has no attribute '_rational_matrix'

It seems my code is working when both matrices in the tensor product are rational or when self is non-rational, but not when self is rational and the argument is non-rational. Should I be somehow instructing sagemath to regard self as a matrix over the cyclotomic field?

2021-01-08 17:38:06 +0100 received badge  Scholar (source)