Ask Your Question

Kraig's profile - activity

2019-11-26 16:26:54 +0100 commented question Grabbing Output in Linux

I actually asked this same question in my Pascal forum and they said "this sounds like a question to ask the sage community" and the sage community says to ask the Pascal community hahaha! I figured I'm an expert in neither language so I made an attempt to get more "expert" advice before trying to do this on my own. I have an idea to just attach a file to sage and run the sage process with that attached file forever in Pascal, and then update the attached file whenever code is needed (which runs it in sage) and then write the output to another file which I then grab from.

2019-11-26 14:24:27 +0100 commented question Grabbing Output in Linux

Sage is also a computer algebra system. I have an entire program written in another language, so I was wondering if there was some fast way to have my program run sage to get output.

2019-11-26 01:04:10 +0100 received badge  Editor (source)
2019-11-26 01:03:50 +0100 asked a question Grabbing Output in Linux


I have a great deal of code written in Pascal, and this code runs on a linux terminal. Currently, the only way I can run sage math through this program is to do the following: type a list of commands to run in sage as a concatenated strings separated by semicolons, and I then write the output to a textfile. For example 'load(''whatever'');function_call(something);... > sometextfile.txt'. This entire line is written in a call to the terminal. Effectively what is fed is sage -c that-string. The problem with this method is it adds time because sage has to open and close every time it runs. Is there a command in sage that allows me to keep the sage terminal persistent and I then ping that terminal with new commands. I assume the way to ping with new commands is to pipe from one terminal to the one running sage, but I am not a unix connisseur.

Of course, the easiest method is to run my code via python and have python run the pascal code. This is, unfortunately, not an option.

2019-11-24 22:40:07 +0100 received badge  Scholar (source)
2019-11-23 20:01:23 +0100 asked a question Absence of column vectors

I'm curious as to why column vecotrs seem to be non-existent in sage. To give you some context, I work with the following system:

R3 = IntegerModRing(3)
c_7_4 = [
[1, 0, -2, 0, 0, 0, 1],    
[1, 1, 0, 0, -2, 0, 0],    
[0, 1, 1, 0, 0, -2, 0],    
[0, 0, 1, 1, 0, 0, -2],    
[0, -2, 0, 1, 1, 0, 0],    
[-2, 0, 0, 0, 1, 1, 0],    
[0, 0, 0, -2, 0, 1, 1]
C3 = Matrix(R3, c_7_4)     
B3 = C3.right_kernel().basis()

Clearly, the right kernel of C3 is a column vector, but if you run this code, you would find that

print(B3[0]) # returns a row vector
print(B3[0] * C3) # returns an answer
print(C3 * B3[0]) # returns an answer

Given that a column matrix should reasonably be written


Why is this not the case? Specifically, is there a coding limitation to what the programmers can do which forces them to implement it in this way, or is there some mathematical usefulness to this which is beyond my understanding?