Ask Your Question

vikahdv@gmail.com's profile - activity

2023-11-27 08:23:25 +0200 received badge  Popular Question (source)
2022-01-26 23:20:56 +0200 received badge  Popular Question (source)
2021-11-09 00:41:05 +0200 received badge  Famous Question (source)
2021-07-16 23:56:21 +0200 received badge  Notable Question (source)
2021-06-04 23:19:00 +0200 received badge  Popular Question (source)
2020-12-22 05:55:55 +0200 commented answer How do you load a file to the SageMath 9.1 Console?

@slelievre Thank you, I still need 50 rep points to do so.

2020-12-21 06:30:02 +0200 received badge  Self-Learner (source)
2020-12-21 06:30:02 +0200 received badge  Teacher (source)
2020-12-21 05:40:49 +0200 answered a question How do you load a file to the SageMath 9.1 Console?

Here's how I figured it out on Windows 10 with SageMath 9.1, for any future persons confused by this.

  1. I decided to put my Sage scripts in the folder C:\scripts\sage.

  2. I added this path to Sage's load attach path so Sage knows where to look. I did this in the console with

    sage: load_attach_path('C:\\scripts\\sage')

  3. To load eaxmple.sage from the above directory, I can now simply use

    sage: load('example.sage')

2020-12-20 04:11:19 +0200 asked a question How to tell Sage to do arithmetic in base $b$?

Suppose you have two numbers which are already expressed in binary, and you want to do some arithmetic with them. How do you tell Sage that the strings you're inputting are already expressed in base $2$, and you would like the output to also be in base $2$. For example, I'd like something that works like this

sage: 10010 + 1010
sage: 11100

but I can't figure out how to tell Sage I wish to work in base $2$, or more generally, base $b$.

2020-12-18 03:47:15 +0200 received badge  Editor (source)
2020-12-18 03:46:59 +0200 asked a question Quickly recalling the definition of a temporary function to make minor edits?

Suppose you're working with the sage console primarily as a calculator, and define some temporary shorthand function, such as,

sage: R = GF(751)
sage: def f(x):
....:    return R(x^3-x+188)

After I've used this f several times, I may want to change the output to something similar, like x^3-x+376. Is there a quick way to recall the definition of f within the console so that I can edit in the minor change, instead of having to define a new function?

2020-12-18 03:39:44 +0200 received badge  Scholar (source)
2020-12-18 03:39:43 +0200 received badge  Supporter (source)
2020-12-12 23:12:29 +0200 received badge  Student (source)
2020-12-01 05:08:08 +0200 asked a question Is there a shortcut command to iterate an endomorphism?

Suppose $f$ is a function from some set to itself. Is there a shortcut command in sage to compute an iterated composition of $f$, such as $f^3(x)=f(f(f(x)))$ where I could type something like f^3(x) into the console, and more generally for computing $f^n(x)$ for a given $n$?

2020-11-28 19:12:54 +0200 asked a question How do you load a file to the SageMath 9.1 Console?

I am trying to follow the Loading and Attaching Sage files tutorial. I am working on Windows 10. I created an example.sage file by simply writing a .txt file and changing the extension to .sage, and put it on my desktop, located at

C:/Users/vika/Desktop/example.sage.

In the SageMath 9.1 Console, I get the following issues depending on the type of slash

sage: load("C:/Users/vika/Desktop/example.sage")
OSError: did not find file 'C:/Users/vika/Desktop/example.sage' to load or attach
sage: load("C:\Users\vika\Desktop\example.sage")
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Where am I supposed to put this file in order to load it? I know that sage is installed at C:/Users/vika/AppData/Local/SageMath 9.1 if that matters.