Ask Your Question

Iguananaut's profile - activity

2020-08-04 18:11:27 -0500 received badge  Good Answer (source)
2020-08-03 15:25:19 -0500 received badge  Nice Answer (source)
2020-08-03 12:38:36 -0500 received badge  Necromancer (source)
2020-08-03 09:18:08 -0500 commented answer Running VIM inside Sage Shell

See the documentation for the %edit magic. It's a little confusing, but it does not work exactly the same as entering the code directly in the interactive prompt. If you just write a bare expression like 1 + 1, although it will be evaluated, its results are not displayed. Instead you have to write something like print(1 + 1) if you want the results displayed when executing the code. The %edit command outputs the code entered as a string allowing you to do things like %edit _ to re-edit the previous code.

2020-08-03 09:06:55 -0500 answered a question SageMath 9.1 for Windows

Sage 9.1 for Windows was released last week: https://github.com/sagemath/sage-wind... Sorry for the long delay on this one.

2020-08-03 09:06:20 -0500 commented question SageMath 9.1 for Windows

@Emmanual Charpentier: The information in your last comment is a bit inaccurate. There have been SageMath for Windows releases for some time now: https://wiki.sagemath.org/SageWindows I know you know this because you directly referred to it. But it is what is meant by "SageMath for Windows". The fact that it uses Cygwin is a technical detail not relevant to most users (although sometimes good to be aware of for more intermediate users, especially when it comes to understanding how it maps UNIX paths to Windows paths and vice-versa).

@Masacroso: It shouldn't usually take several months, but right now I'm the only one building the Windows installer releases and I had some setbacks in my ability to build the 9.1 release. Usually it should be out within a week or so of the source release

2020-07-28 14:09:37 -0500 received badge  Great Question (source)
2020-06-19 07:48:46 -0500 edited question Plotting Fermat' s Spiral, which requires polar coordinates, r=2theta

Try Plotting Fermat' s Spiral, which requires polar coordinates, r=2theta?

2020-06-19 07:47:56 -0500 edited question find the root of tan(x)

Find the root of Tan(x)?

2020-04-27 16:44:15 -0500 received badge  Nice Answer (source)
2020-02-21 09:53:29 -0500 received badge  Popular Question (source)
2020-02-04 08:24:15 -0500 commented question Other than "Jupyter Notebook", is there any other way to use Sage?

You can find instructions for configuring PyCharm with sage here: https://ask.sagemath.org/question/397...

2020-02-03 09:28:48 -0500 commented answer Sagemath and Vscode

... I was able to run the interpreter. But I think there should be a better way. And it doesn't seem to work for commands like "Python: Start REPL". I need to reverse engineer how the Python extension searches for activate scripts, such as when it activates virtualenvs and conda envs, and see if the same mechanism can be used to load a sage-env. This issue also seems to be a problem: https://github.com/microsoft/vscode-p... It might be best for a Sage environment to change the default shell to the bash that comes with Sage, but I don't know how to do that yet. Still figuring out how to configure VSCode and some of it is very confusing...

2020-02-03 09:26:21 -0500 commented answer Sagemath and Vscode

I don't think that's really the problem. I was able to set up a workspace where I set "python.pythonPath" to the windows path to Sage's Python interpreter. To get the Windows path, from the Sage shell you can run cygpath -m -a $(which python3), which in my case returns C:/Users/Erik M. Bray/AppData/Local/SageMath 9.0/runtime/opt/sagemath-9.0/local/bin/python3.7.exe. Putting this in "python.pythonPath" almost works, except the additional trick is that at the very least you also need to have the $PATH environment variable set properly. I was able to do this by creating a sage.env file like echo "$(cygpath -p -m "$PATH")" > sage.env, and then in my workspace settings set "python.envFile" to the path to that sage.env. This partly works....

2020-02-03 07:09:06 -0500 commented answer Sagemath and Vscode

I'm not exactly sure what you mean here: "it's not able to detect Sage's Python executable because VSCode uses import sys; print(sys.executable) to get the actual path". In order to run some code in a specific Python interpreter, doesn't it need to already know the path to that Python interpreter in the first case? In what context does VSCode do this? I think I actually have VSCode installed but I never use it, or if not I'll go ahead and install it and see what I can find out...

2020-02-03 07:06:15 -0500 commented question Problem with %attach for SageMath 9.0 on Windows 10 with .spyx files

Could you please post a piece of sample code which reproduces the problem for you? I can reproduce the problem with 8.9, but not with 9.0.

2020-01-31 14:39:20 -0500 received badge  Necromancer (source)
2020-01-31 11:27:10 -0500 commented answer Updating Sage in Windows 10

Hi, I'm not sure what you intended exactly by this answer but it appears to be misleading. Sage on Windows uses Cygwin. MinTTY is just a terminal emulator that is included in Cygwin, and is also the terminal emulator used by default when running Sage for Windows.

2020-01-31 11:25:24 -0500 answered a question Updating Sage in Windows 10

I forgot about this question, but just as a quick follow-up Jesus and I met last week at the University of Essex and I walked him through building Sage on Windows/Cygwin using the instructions at: https://trac.sagemath.org/wiki/Cygwin...

As we noted at the time, one bit of information currently missing from those instructions is to set:

export FFLAS_FFPACK_CONFIGURE=--disable-openmp

This is just to work around a slight defect in the build system that should get fixed at some point...

2020-01-31 11:21:37 -0500 commented question Problem with %attach for SageMath 9.0 on Windows 10 with .spyx files

I tried it on 9.0 and it does appear to be fixed. Compiling the spyx module is a little slow--slower than it should be for some reason--but it works.

2020-01-31 11:13:54 -0500 commented question Problem with %attach for SageMath 9.0 on Windows 10 with .spyx files

Have you tried 9.0? I believe this problem may be fixed in 9.0.

2020-01-31 11:11:30 -0500 commented question Download Ver 8.9

Where did you look? When you go to the download page and select a mirror and OS, each page lists old versions.

2020-01-31 11:10:09 -0500 edited question Download Ver 8.9

I need to download SageMath8.9 for a class, but online, the only version I can find for download is 9.0. Where can I download 8.9?

Thanks.

I need version 8.9 for a class, but I can only find links to download 9.0 online. Where can I find a download for 8.9?

Thanks.

2020-01-31 11:09:29 -0500 commented answer Sagemath and Vscode

Well done. Shame about the patch to tornado; I don't see another way around it until/unless it's fixed upstream.

One thing I'm a bit confused by: You seem to mention that VSCode comes with its own Python into which you can install Jupyter Notebook, and indeed you mention pip installing Jupyter. But then you say you're running the Jupyter Notebook that comes with Sage, so the previous copy of notebook is never actually used as far as I can tell...unless you're just using Sage Notebook to start the kernel?

It would be easier if you copied the sage/kernel.json to somewhere else (not modifying the Sage installation, which is a bit dangerous), and instead installed a copy of that kernel directly into the jupyter notebook you installed on your system kernel. Should work.

2020-01-23 09:45:28 -0500 commented answer Attempting to enrich quiver class yields "unexpected keyword argument" error

This is basically correct, and passing an arbitrary **kwargs to a subclass's constructor is a fairly common idiom. A couple (very minor) nitpicks where your code is non-idiomatic:

  • Python has a style guide called PEP-8, which is also used by Sage (see Sage Coding Conventions. Most of your code is already PEP-8 except the self._edgePairs. camelCase is not used for local variables or attributes; instead you could call this self._edge_pairs (like I said, very minor)
  • The line assert edge in self.edges() is unnecessary; if it isn't true the following line will raise a KeyError, which is more explicit than an AssertionError anyways.
2020-01-15 07:13:59 -0500 received badge  Necromancer (source)
2020-01-13 06:05:17 -0500 commented answer Working with units

astropy also has a very powerful units and quantities package which took much of its original inspiration from Pint. Actually, lately they've been converging more and more again on shared functionality (thanks in part to recent updates to Numpy making propagation of units easier)--I wonder if one day it will be possible for them to converge, rather than maintaining separate projects. Though astropy.units does have some more advanced functionality specific to the astronomy community (though also useful for most any science).

2020-01-13 06:00:59 -0500 edited question Generating and evaluating a polynomial

I woud like to create a polynomial P(x) = 1 + x + x^2 + ...... + x^50 and evaluate it for different values of x.

What would be a good way to do this without entering it by hand.

Thank you!

I am very new to Sage. I would like to create a polynomial and evaluate it for a certain x say x=1.00001

The polynomial is: P(x) = 1 + x + x^2 + ..... + x^50

Thank you for the help!

2020-01-09 07:58:21 -0500 commented answer Problem importing Sage library in Python script on Windows

If you can be more specific about what exactly you tried to do and where you got stuck I might be able to give a more precise answer.

2020-01-09 07:57:57 -0500 commented answer Problem importing Sage library in Python script on Windows

SageMath is really two things: There's what's referred to sometimes as "sagelib": the actual sage Python package, and then there's "Sage the Distribution" consisting of sagelib and all its dependencies. Though there's been some work done toward making Sage installable with pip like any Python package (there's no strong reason Sage needs its own Python interpreter) it's still non-trivial because you need most of the dependencies already in place. An (outdated) list of those dependencies is here. Some of those are optional, but many non-trivial ones are very integral. conda makes it seem easy because it can pull in all those dependencies, but outside that context it's not trivial.

2020-01-09 05:10:57 -0500 answered a question Problem importing Sage library in Python script on Windows

I'm not sure what you mean exactly by "using Sage in a Python script". You didn't really provide any details.

Sage has always traditionally included its own Python interpreter, and so using Sage meant you'd have to run the Python interpreter that comes with Sage (if you're at all familiar with conda as you say, this is a little like having its own conda environment). The folks who've packaged Sage for conda make that a little more transparent, since you can now install sage directly in a conda environment. But either way it's effectively similar.

What do I need to do with the installation to get my python script to find Sage?

You will need to run it with the Python interpreter that comes with Sage. If you have additional dependencies, as I wrote, this is a complete Python environment so you can pip install them using Sage's Python.

As an aside, is there a reason why there is no conda package for Sage on Windows, only Linux and MacOS?

Because Sage on Windows depends on Cygwin, and there is no official Cygwin target for conda. There could be, and it's something I would like there to be, but it would be a large effort for which there is currently no support.

But it seems completely incompatible for integration with other languages/tools.

Not necessarily but it is a little tricky. Search this site for other questions like this one where I explain how to use Sage in PyCharm--again it's not all that different from using a virtualenv; still just a little trickier. If you have any good ideas for how to make this easier I'm all for it.

When I looked at the log for that, it seems like there was a connection issue and the source could not be downloaded.

I noticed also there were some problems with some connection problems with some of the mirrors yesterday. Try just running make again and the build should resume where it left off. If you followed the instructions here it should work.

Sage is a complex beast: Its large set of non-standard and/or tightly-pinned dependencies makes it non-trivial to install and use compared to a normal Python package. People have been working hard for years to make that easier (see, again, your success with conda) but this is not easy. You're welcome to lend a hand if you have any insights.

2020-01-09 04:56:17 -0500 commented answer Should I avoid using unicode in names of variables?

IPython on Python 3, yes.

2020-01-08 12:14:35 -0500 received badge  Nice Answer (source)
2020-01-08 11:29:10 -0500 commented answer Should I avoid using unicode in names of variables?

@dsejas I agree, it might be good to have a module defining unicode aliases for different globals. It can be made to load on Python 3 only (which is now the default anyways).

2020-01-08 11:27:43 -0500 edited answer Should I avoid using unicode in names of variables?

In Python 3 you can do some nice things like:

sage: π = pi
sage: sin(π)
0
sage: cos(π)
-1

and so on. For Python 3 builds of Sage it would be nice to have a few of these built-in. Per my comment on Nil's answer, special characters can be input fairly easily by using tab-completion.

Ticket: https://trac.sagemath.org/ticket/28966

2020-01-08 11:27:28 -0500 commented answer Should I avoid using unicode in names of variables?

I meant to add; I opened a ticket for this. I suggest following up there with suggestions: https://trac.sagemath.org/ticket/28966

2020-01-08 09:18:59 -0500 commented question Rotate a parametric plot

As in just, rotating all the pixels of the image, including axes? I'm still not sure why you would want to do that. And also the question is: rotate by an arbitrary amount, or just by 90 degrees? Since rotating images by arbitrary angles means you need some way to deal with clipping. Perhaps you could just add some example images of what results you're trying to obtain...

2020-01-08 09:16:36 -0500 commented answer ask.sagemath.org Y2k20 bug

I'm impressed that you bothered to track it down :)

2020-01-08 09:13:59 -0500 commented answer Should I avoid using unicode in names of variables?

Of course--this is an IPython feature.

2020-01-07 10:54:30 -0500 commented answer Should I avoid using unicode in names of variables?

You would have to look into what unicode completion plugins exist for emacs (I'm sure there are several).

2020-01-07 10:52:08 -0500 commented question Rotate a parametric plot

I don't know Maple so I don't know exactly how to interpret that example. But what do you mean by "rotate a plot"? That could have several different interpretations. In the example you gave in Sage you didn't rotate the plot so much as you rotated a vector field and that plotted the rotated vector field. Do you want to rotate the axes? The entire image?

2020-01-07 10:40:31 -0500 received badge  Good Question (source)
2020-01-07 10:39:03 -0500 received badge  Nice Question (source)
2020-01-07 09:25:53 -0500 commented question TypeError: 'sage.rings.integer.Integer' object is not iterable

What do you mean by "When I try to compile it" Do you mean when you run it? I can't reproduce the problem because your code sample has several presumably custom-written functions. What does the full traceback show? This "WARNING: Code contains non-ascii characters" is also mysterious. The code you showed us does not obviously contain any non-ascii characters. In short, without at least knowing what gen_par, up, down, keygeneration, randompolyBinary enc, dec, are there's no way to tell you what the problem is. But apparently you are trying to iterate over an integer somewhere.

2020-01-07 09:21:41 -0500 commented question Sage error from module `typing` and python 3.8

I'm not exactly clear how you're installing Sage. Sage doesn't support Python 3.8 yet.