Ask Your Question
0

Command matrix() not work, but worked before

asked 2023-12-24 12:55:44 +0100

updated 2023-12-25 11:35:35 +0100

FrédéricC gravatar image

coeff = matrix(QQ, [[-7, -6, -12], [5, 5, 7], [1, 0, 4]])


NameError Traceback (most recent call last) Cell In[1], line 1 ----> 1 coeff = matrix(QQ, [[-7, -6, -12], 2 [5, 5, 7], 3 [1, 0, 4]])

NameError: name 'matrix' is not defined

What to do?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2023-12-24 14:06:40 +0100

eric_g gravatar image

It works for me with SageMath 10.2. Are you sure you are running a SageMath kernel and not a Python kernel? If yes, please describe your version of SageMath, your OS and how you have installed SageMath.

edit flag offensive delete link more

Comments

Version: Sage 10.2. OS: macOS Sonoma 14.2.1. Sage installed via home-brew - worked fine. The above script runs first ok using Jupiter lab, and it runs ok using Sage interactive terminal. But now no more using Jupiter ..

Obviously I run (now) a Python kernel. Q: how to change kernel from Python3 -> SageMath kernel?

DrWGL gravatar imageDrWGL ( 2023-12-24 16:01:14 +0100 )edit
0

answered 2023-12-25 10:49:55 +0100

I solved the problem by brute force: uninstall Sage-10.2 and install a new version Sage-10.2.app. Using also the recommended surplus package now gives the choice in the JupiterLab (button RHS above) to choose between different kernels, a Python3 kernel.. and a Sage-10.2 kernel :)

Thanks to Eric for the hint that I run the false kernel to use Sage.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2023-12-24 12:55:44 +0100

Seen: 191 times

Last updated: Dec 25 '23