ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 27 Feb 2015 12:17:51 +0100HTML Input Pagehttps://ask.sagemath.org/question/25946/html-input-page/ I am just starting to look at SageMath and I like it a lot.
I am wondering if it is possible to create a kind of app (I am using the cloud version). I know how to render html (%html or even %md) so I know I could create a nice looking form with some input boxes.
Is it then possible to "submit" the form and then have the input values passed to another worksheet which has all the calculations on it...then the results get posted back to the nice HTML "front GUI" page...mostly in the forms of plots?
I have a worksheet going that is full of code that create the necessary plots...the input variables are just set manually at the top, e.g.:
var1 = 1
var2 = 2
and so on. So I am wondering if I can link the html form input boxes on the front sheet to these vars, run the rest of the code on that worksheet, then present the results (plots) back on the front page?
Very similar to the way one would right HTML, submit it to a PHP file, which in turn would produce HTML results...
Thanks in advance!j0nrFri, 27 Feb 2015 12:17:51 +0100https://ask.sagemath.org/question/25946/convert outputhttps://ask.sagemath.org/question/23650/convert-output/ Hello, if a function gives an output like this
> 2.00000000000000 - 2.77555756156289e-17*I
how could one convert it to be simply
> 2
BestsTomyThu, 31 Jul 2014 21:30:30 +0200https://ask.sagemath.org/question/23650/How to store outputs from a function for later usehttps://ask.sagemath.org/question/10176/how-to-store-outputs-from-a-function-for-later-use/My function that I have written to compute the rank of fundamental representations is as follows:
# given a prime p, return all A_n representations of dimension = p^2
def rankrep(p):
bound = p*p
s = SymmetricFunctions(QQ).schur()
Sym_p = s[p]
A = lambda i: WeylCharacterRing("A{0}".format(i))
deg = []
index = []
L = []
for i in xrange(bound):
deg.append([])
fw = A(i+1).fundamental_weights()
temp = A(i+1)
for j in fw.keys():
deg[i].append(temp(fw[j]).degree())
if temp(fw[j]).degree() == bound:
index.append('A'+str(i+1)+'(fw['+str(j)+'])')
L.append(fw[j])
return index, deg
But now if I call `rankrep` it does not let me store `index` or `deg`, it just prints them. I am wanting to also store the `L` variable I create as these are the weights that give me the desired dimension, and convert from these weights, which make up the highest weight $\Lambda = a_1 \omega_1 + \cdots + a_n \omega_n$ (here $\Lambda$ is the high weight, $\omega_i$ are the fundamental weights). The $\omega_i$ have the form $(1,1,\dots,1,0, \dots, 0)$, and I would like to express my high weight as $(a_1 + \cdots + a_{n-1}, a_2 + \cdots + a_{n-1}, \dots, a_{n-1},0)$. However, since I am only considering one of the $a_i$ nonzero, this vector will look like $(a_i, a_i, \dots, a_i, 0, \dots, 0)$. I would like to store this vector, and then pass it as a partition to a `schur` function `s` that I define in the code.
> How can I store these outputs and format them (i.e., data types, lists, dictionaries, vectors) so that I can then alter them as described and apply my schur function?
JoshIzzardFri, 31 May 2013 11:15:08 +0200https://ask.sagemath.org/question/10176/Convert a text file into a matrixhttps://ask.sagemath.org/question/9973/convert-a-text-file-into-a-matrix/I have a file with a list of elements inside the square of a Quadratic field, i.e. `QQ(sqrt[13])^2`. The file looks like `[[2 + sqrt[13],4 - 2*sqrt[13]],[2,sqrt[13]],...]`. I want to import this file into a single matrix over the field, in the previous example `F.<a> = QuadraticField(13)`. Currently, I read everything in as a string then convert to the matrix, but there must be an easier way to do this. I am somewhat new to python programming in general.jmcshan1Tue, 02 Apr 2013 12:42:35 +0200https://ask.sagemath.org/question/9973/