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.Tue, 25 Oct 2022 15:02:04 +0200solve_mod() takes long time and no result return when computing big numbershttps://ask.sagemath.org/question/64600/solve_mod-takes-long-time-and-no-result-return-when-computing-big-numbers/when I use solve_mod to solve equations like slove_mod([3*x + 2*y == 5,6 * x + 5 * y ==11],13),it will return a result quickly . However,when i use it like solve_mod([9677035*x + 7162589 *y == 4477085 ,5302728*x + 8472081*y == 11061226],14282531),it takes long time but no result return, i was wondering whether solve_mod()'s alogrithm is horrible when big numbers are computed.Is there a faster way to solve big numbers equation?
charleyhootTue, 25 Oct 2022 15:02:04 +0200https://ask.sagemath.org/question/64600/How to know if some indexed variables are implied in a list of conditionshttps://ask.sagemath.org/question/61578/how-to-know-if-some-indexed-variables-are-implied-in-a-list-of-conditions/ Suppose you have an indexed list of variables say :
x = var("x", n=11)
Z=list(x)
and a list of conditions :
Cond = [x_1 >=0, x_2==0, x_6<=0]
First I am not sure that `x_1` refers to the indexed variable with the same index. Then how to make a list of variables for which there is no condition inside `Cond`. CyrilleTue, 22 Mar 2022 17:41:24 +0100https://ask.sagemath.org/question/61578/Defining an indexed list of variable with Latex_namehttps://ask.sagemath.org/question/61574/defining-an-indexed-list-of-variable-with-latex_name/The answer of this question `Creating a vector of indexed variables` asked two years ago, is deprecated for the `Latex_name` part which seems natural since from that time one must use either `\\` or `r''` in place of only `\`. I have tried many thing but none works.
Here is the incriminated command
x = var("x", n=8, latex_name='\overline{x}')
show(x)
PS Deprecation apart, doesn't work in Jupyter with Sagemath 9.2 but works in Sagecell.CyrilleTue, 22 Mar 2022 15:36:04 +0100https://ask.sagemath.org/question/61574/Declare diagonal matrix with unknown variables in GF(2).https://ask.sagemath.org/question/61381/declare-diagonal-matrix-with-unknown-variables-in-gf2/I have an equation of the form $AXB = V$, that I am trying to solve using Sage. All matrixes are in $GF(2)$, $A$ and $X$ are of size 32x32, and $B$ and $V$ column vectors of size 32.
My unknown matrix $X$ consists in zeros, except on the diagonal where I'd like to have 32 unknowns (representing each bit of a unknown 32-bits integer). I first tried to declare an array of variables like this:
```
vars_list = list(var("x_%d" % i) for i in range(32))
```
which throws me a "TypeError: x_0 is not a variable of Univariate Polynomial Ring in X over Finite Field of size 2 (using GF2X)". Looking at Sage documentation, I didn't find a way to declare them in $GF(2)$.
[Using this link](https://groups.google.com/g/sage-support/c/eRdR8xtEvtA), I tried to declare my variables like this:
```
x_1 = SR(GF(2)(1)) * var("x1")
```
which gave me this time a "TypeError: positive characteristic not allowed in symbolic computations".
How should I setup $X$ so I can solve my equation?KatoptrissThu, 03 Mar 2022 19:24:52 +0100https://ask.sagemath.org/question/61381/Differentiate vector field w.r.t a variable not defining the charthttps://ask.sagemath.org/question/59533/differentiate-vector-field-wrt-a-variable-not-defining-the-chart/I define a 3+1-dimensional manifold **M**:
n = 3
M = Manifold(1+n, 'M', structure='Lorentzian')
and a chart **X** with spherical coordinates **t**, **r**, **th** and **ph**.
X.<t,r,th,ph> = M.chart('t r:(0,+oo) th:(0,pi) ph:(0,2*pi)')
I define the following symbolic function **Ne**, which depends on **r** and a new variable, **eps**:
eps = var('eps')
Ne = function('Ne')(r,eps)
Now, I define a vector field, **u**, as:
u = M.vector_field('u')
u[0] = 2*Ne; u[1] = Ne; u[2] = 0; u[3] = 0
At this point, I want to differentiate each term of **u** with respect to **eps**. However, when I write:
diff(u[0],eps)
I get:
> ValueError: tuple.index(x): x not in tuple
However, I would expect to obtain:
> 2*diff(Ne(r, eps), eps)
I guess this is because I am differentiating a vector field from the manifold with respect to a variable (eps) which is not on the chart. In fact, if I differentiate with respect to $r$, then everything goes right. Is there a way I can fix this?
kekoFri, 29 Oct 2021 14:18:25 +0200https://ask.sagemath.org/question/59533/interact variables work differentlyhttps://ask.sagemath.org/question/54068/interact-variables-work-differently/This interact works but I'm unclear why I only need n in the body of the function, but ymax alone fails. I have to make it ymax=ymax. They should both work the same.
@interact
def _(n=(1,20),ymax=(50,200)):
show(plot([.5*x^2,x^2,2*x^2],-n,n,legend_label=[".5*x^2","x^2","2*x^2"],aspect_ratio=.2),ymax=ymax)cybervigilanteThu, 29 Oct 2020 02:07:48 +0100https://ask.sagemath.org/question/54068/Greek variableshttps://ask.sagemath.org/question/50919/greek-variables/ Is it possible now that sagemath is under Python 3 to use greek letters as variables ? I remember this answer by tmonteil
"it is not possible to use unicode λ in variables names, since Sage relies on Python 2, which does not allow it, so you have to wait the migration of Sage to Python 3 for that."CyrilleWed, 22 Apr 2020 18:08:50 +0200https://ask.sagemath.org/question/50919/How to define polynomial p(x_i, x_j) while x_i, x_j runs over available variables?https://ask.sagemath.org/question/47167/how-to-define-polynomial-px_i-x_j-while-x_i-x_j-runs-over-available-variables/Let's say I have variables x_1, x_2, ..., x_d, where d is some integer. Let's say I have a polynomial p(a,b) defined. How could I get a list of p(x_i, x_j) where i, j runs over 1, 2, ..., d, possibly with some other qualifiers (i.e. we must have i inequal to j)? I want to define an ideal in this way, but when I get a list I know how to proceed.
Thank you in advance! AnteCMon, 15 Jul 2019 14:42:51 +0200https://ask.sagemath.org/question/47167/How can I get mpmath to work with sage variables?https://ask.sagemath.org/question/39921/how-can-i-get-mpmath-to-work-with-sage-variables/ In Sage, the following code produces error messages ending with "TypeError: cannot evaluate symbolic expression numerically":
from mpmath import *
var('a')
print sqrt(a)
If I remove the line "from mpmath import *", it prints "sqrt(a)" as expected.
How can I get mpmath to work with sage variables?
millermjSun, 03 Dec 2017 00:10:43 +0100https://ask.sagemath.org/question/39921/How can I get back an expression for free variables in solve function.https://ask.sagemath.org/question/39396/how-can-i-get-back-an-expression-for-free-variables-in-solve-function/I have a number of linear equations on some symbols A,B,C,D,E,F,G. When I solve them in Sagemath, I get some free variables in the solution.
$A,B,C,D,E,F,G=var('A,B,C,D,E,F,G')$
$eqns=[A+B==0,C+D+E==0,F+G==0,A+E-F==0]$
$solution=solve(eqns,A,B,C,D,E,F,G)$
Sage gives the following solution:
$[[A == r1, B == -r1, C == r1 - r2 - r3, D == r3, E == -r1 + r2, F == r2, G == -r2]]$
Now I can ask Sage to give me an expression of any combination of the symbols, for example:
$(A+C).subs(solution)$, then I get $2*r1 - r2 - r3$.
For my purpose I would now like to have an expression for any of the free variables. If I assign $r1=var('r1')$ and ask Sage $s1.subs(solution)$ I get back $r1$ again. But I would lik to get back an expression in terms of $A,B,C,D,E,F,G$.
Any suggestions on how to do this?TheBeiramMon, 06 Nov 2017 11:29:40 +0100https://ask.sagemath.org/question/39396/How to dynamically add boolean variables?https://ask.sagemath.org/question/36279/how-to-dynamically-add-boolean-variables/ I want to experiment with Groebner bases for a system of equations in boolean unknowns. In order to simplify equations I would like to dynamically insert new variables for some terms. Is this possible somehow?
An example could be:
F = BooleanPolynomialRing(4, ["x0", "x1", "x2", "x3"])
F.inject_variables()
eqns = [x0 + x1*x2 + x3 + 1, x0 + x1*x2*x3, x0 + 1]
# now add 'y == x1*x2'
eqns = [x0 + y + x3 + 1, x0 + y*x3, x0 + 1] # NameError: name 'y' is not defined
asanteFri, 13 Jan 2017 09:02:13 +0100https://ask.sagemath.org/question/36279/Generate a Matrix over a Finite Field with symbolic variableshttps://ask.sagemath.org/question/36148/generate-a-matrix-over-a-finite-field-with-symbolic-variables/ Hi everyone,
I am currently trying to generate a matrix over a finite field of 2 using symbolic variables a,b,c,and d instead of integers. The current problem I am having is that sage tries to convert these variables into integers and do not allow me to generate the matrix.
Inputting:
var('a, b, c, d')
m = matrix(GF(2), [[a,b], [e,f]])
gives me the error:
TypeError: unable to convert a to an integer
Please help, Thank you!!!benliuTue, 03 Jan 2017 16:47:45 +0100https://ask.sagemath.org/question/36148/Why use symbolic functions?https://ask.sagemath.org/question/36084/why-use-symbolic-functions/ So, I can do the following by introducing x as a symbolic function.
sage: var('b,c,t')
(b, c, t)
sage: x(t) = sqrt(b^2 + c^2*t^2) - b
sage: x
t |--> -b + sqrt(c^2*t^2 + b^2)
sage: diff(x,t)
t |--> c^2*t/sqrt(c^2*t^2 + b^2)
I can introduce x as a variable with assigned symbolic values, and get the same result.
sage: var('b,c,t')
(b, c, t)
sage: x = sqrt(b^2 + c^2*t^2) - b
sage: x
-b + sqrt(c^2*t^2 + b^2)
sage: diff(x,t)
c^2*t/sqrt(c^2*t^2 + b^2)
So, since I can do the same thing using variables, why use symbolic functions at all? Can symbolic functions do things that variables can't do?
Thanks in advance.omoplataSat, 24 Dec 2016 20:44:49 +0100https://ask.sagemath.org/question/36084/Summation with variables in limithttps://ask.sagemath.org/question/35701/summation-with-variables-in-limit/ Hi, I am new to Sage (and programming for that matter). I would like to sum (a1 +a3)(a1+a4)(a2+a3)(a2+a4) over all non-negative integers a1, a2, a3, a4 which satisfy 2*a1 + a3 + a4 less-than D and 2*a1 + a3 + a4 less-than D. Of course, my answer should be in terms of D (I have already declared D as a variable).
I have tried using the standard sum function, but that doesn't seem to work over more than one variable. I could try writing my sum as several sums, each over a single variable, but that seems tedious. Does sage allow for more complicated summations like the one I would like to calculate? If so, I would be grateful for an example.
I have tried searching for similar questions on this site, as well as google searching, but I have had no success.
Thank you.
Michael YWed, 23 Nov 2016 16:04:08 +0100https://ask.sagemath.org/question/35701/how to sum up the function over all permutations of variables in associative non-commutative algebrahttps://ask.sagemath.org/question/34714/how-to-sum-up-the-function-over-all-permutations-of-variables-in-associative-non-commutative-algebra/ hello, i need to sum up $\lambda_{\sigma}(a_{\sigma(1)}a_{\sigma(2)}a_{\sigma(3)}-a_{\sigma(3)}a_{\sigma(4)}a_{\sigma(5)})$ over all $\sigma\in S_5$ where $a_i$ are elements of associative non-commutative algebra.
the result should be $E_1a_1a_2a_3a_4a_5+\cdots+E_{120}a_5a_4a_3a_2a_1$
and i need to express $E_i$ in terms of $\lambda_{\sigma}$.
actualy my tartget is to find non-zero solution of $E_i=0$ for all $i$.RadmirSun, 04 Sep 2016 15:19:15 +0200https://ask.sagemath.org/question/34714/Split result of solve?https://ask.sagemath.org/question/33278/split-result-of-solve/Beginner question - In using **solve** to get the value of a variable involving a square root I end up of course with two possible answers. Is there an easy way to "split up" that result into two variables that I can use in for further calculations in my code?bw0n6Sun, 01 May 2016 20:05:55 +0200https://ask.sagemath.org/question/33278/How to get the list of user defined variableshttps://ask.sagemath.org/question/9763/how-to-get-the-list-of-user-defined-variables/How do I get the list of user defined variables in a sage session I just loaded using the load_session command ?EdinahFri, 01 Feb 2013 18:32:41 +0100https://ask.sagemath.org/question/9763/Variables in Sagehttps://ask.sagemath.org/question/25354/variables-in-sage/ I started using sage today and I encountered sime strange errors:
I declared variables a,b,c,d using var('a,b,c,d'). When I tried to expand ($a^2+b^2)(c^2+d^2)$
(expand($(a^2+b^2)(c^2+d^2$)) I got the following result:
$c^4+2c^2d^2+d^4+b^2$,
which is obviously not the correct result. Does anyone know why I got this incorrect andwer?
slinshadySun, 28 Dec 2014 12:09:21 +0100https://ask.sagemath.org/question/25354/Newbie question: introducing symbols (variables) inside vectors and matriceshttps://ask.sagemath.org/question/23833/newbie-question-introducing-symbols-variables-inside-vectors-and-matrices/Hi,
I would like to have linear algebra operations to be evaluated with symbols instead of numerically.
For example, having the following matrix:
A = matrix(QQ,[
[2,1,2,-6],
[-1,2,1,7],
[3,-1,-3,-1],
[1,5,6,0],
[2,2,1,1]
])
I would like to multiply for a vector with symbolic variables as follows:
t = 'real'
var('x1')
assume(x1,t)
var('x2')
assume(x2,t)
var('x3')
assume(x3,t)
var('x4')
assume(x4,t)
xx = vector(QQ,[x1,x2,x3,x4])
A * xx.transpose()
Unfortunately building the `xx` vector is unsuccessful, producing this error message:
TypeError: Cannot evaluate symbolic expression to a numeric value.
This does not work, so how can I use symbols in sage's linear algebra framework?
thank you very much,
-FrancescostablumTue, 19 Aug 2014 18:18:57 +0200https://ask.sagemath.org/question/23833/Specifying variables to be included in Hessian calculationhttps://ask.sagemath.org/question/23738/specifying-variables-to-be-included-in-hessian-calculation/I want to calculate the Hessian of a function that has 5 variables and 6 parameters.
I do not want the derivatives taken by the parameters.
Is there a way to separately define parameters and variables in sage?
Alternatively, is there a way to make the Hessian function only use some variables for derivation?ShimiMon, 11 Aug 2014 14:58:23 +0200https://ask.sagemath.org/question/23738/x=var('x') - getting TypeError: cannot perform reduce with flexible typehttps://ask.sagemath.org/question/10805/xvarx-getting-typeerror-cannot-perform-reduce-with-flexible-type/I just installed Sage 5.12 under Mac OSX 10.9 (Mavericks). I started the notebook and then proceeded to work through the "Getting started" document. In Chapter One, the first page there is an example of Symbolic programming. It starts with:
x=var('x')
When I evaluate this I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_16.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("eD12YXIoJ3gnKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/private/var/folders/k_/vvbn4jxs6jx2z21s7xdj088c0000gq/T/tmpZ3Z0gy/___code___.py", line 2, in <module>
exec compile(u"x=var('x')" + '\n', '', 'single')
File "", line 1, in <module>
File "/Applications/Sage-5.12-OSX-64bit-10.8.app/Contents/Resources/sage/local/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 2693, in var
keepdims=keepdims)
File "/Applications/Sage-5.12-OSX-64bit-10.8.app/Contents/Resources/sage/local/lib/python2.7/site-packages/numpy/core/_methods.py", line 68, in _var
arrmean = um.add.reduce(arr, axis=axis, dtype=dtype, keepdims=True)
TypeError: cannot perform reduce with flexible type
DOES ANYONE KNOW WHAT IS WRONG WITH THIS?
If I try this from the SAGE command line (as opposed to the notebook) it appears to work. Am I doing something fundamentally wrong by using the notebook for this?
It is Sage's own introductory example, and it is not working! It is the first thing I tried, so it does not give one confidence with the system.
The error appears to be emanating from it's own internal version of Python.
Thanks in advance for any help.
Regards.
Bob
BobBetzThu, 05 Dec 2013 00:44:48 +0100https://ask.sagemath.org/question/10805/derivative of MPolynomial_polydicthttps://ask.sagemath.org/question/11364/derivative-of-mpolynomial_polydict/In a for loop I generate a list of functions, then I take their derivatives with respect to different variables. For example, in the follwoing, `Y[0,0]` is a 'MPolynomial_polydict', and is equal to
x_0_1*x_0_1 + x_0_0*x_1_1 + x_0_2*x_0_2 + x_1_2*x_1_2 + x_0_0*x_2_2 + x_1_1*x_2_2 - 1.00000000000000
and `list_of_variables[0] = x_0_1`. When I take the derivative of the mentioned polynomial with respect to the mentioned variable I should get `2*x_0_1`, but instead I get:
sage: derivative(Y[0,0],list_of_variables[0])
x_0_1
When I try this manually, it gives me the correct answer though:
sage: derivative(x_0_1*x_0_1 + x_0_0*x_1_1 + x_0_2*x_0_2 + x_1_2*x_1_2 + x_0_0*x_2_2 + x_1_1*x_2_2 - 1.00000000000000,x_0_1)
2*x_0_1
So, for some reason it considers the two x_0_1's in the first term of my polynomial as independent variables when I construct them automatically. Any ideas on why this problem arises, and how to fix this?
**Edit:**
This is how I build my vaiables:
names = [ [[] for i in range(n)] for j in range(n) ]
for i in range(n):
for j in range(i+1):
names[i][j] = (SR('x_' + str(j) + '_' + str(i)))
names[j][i] = (SR('x_' + str(j) + '_' + str(i)))
R = PolynomialRing(CC,names[i][j] for i in range(n) for j in range(n)])
R.gens()
R.inject_variables()
**More edit:**
Here is a the complete code:
#########################################################################
# Build variables, and the matrix corresponding to it
#########################################################################
def build_variables(n):
names = [ [[] for i in range(n)] for j in range(n) ]
for i in range(n):
for j in range(i+1):
names[i][j] = (SR('x_' + str(j) + '_' + str(i)))
names[j][i] = (SR('x_' + str(j) + '_' + str(i)))
return(names)
#########################################################################
# Define the function f that maps a matrix to the coefficients of its characteristic polynomial
#########################################################################
def CharPoly(Mat):
X = matrix(Mat)
n = X.ncols()
C_X = X.characteristic_polynomial()
Y = []
for i in range(n):
Y.append(C_X[i])
return(Y)
############################################################################
# This solves that lambda problem
############################################################################
def lambda_siep(G,L,iter=100,epsilon = .1):
# G is any graph on n vertices
# L is the list of n desired distinct eigenvalues
# m is the number of itterations of the Newton's method
# epsilon: the off-diagonal entries will be equal to epsilon
n = G.order()
my_variables = build_variables(n)
R = PolynomialRing(CC,[my_variables[i][j] for i in range(n) for j in range(n)])
R.gens()
R.inject_variables()
X = [ [ R.gens()[n*i+j] for i in range(n) ] for j in range(n) ]
Y = matrix(CharPoly(X)) - matrix(CharPoly(diagonal_matrix(L)))
J = matrix(R,n)
for i in range(n):
for j in range(n):
J[i,j] = derivative(Y[0][i],my_variables[j][j])
B = diagonal_matrix(L) + epsilon * G.adjacency_matrix()
count = 0
while count < iter:
T = [ B[i,j] for i in range(n) for j in range(n)]
C = (J(T)).solve_right(Y(T).transpose())
LC = list(C)
B = B - diagonal_matrix([LC[i][0] for i in range(n)])
count = count + 1
return(B)k1Tue, 29 Apr 2014 02:27:25 +0200https://ask.sagemath.org/question/11364/Transferring variables between worksheets?https://ask.sagemath.org/question/11014/transferring-variables-between-worksheets/How can I save an expression from one worksheet and load it in another? I can certainly do
save(myvar,"myvar")
so that it will be available for future uses of the worksheet, but I want to open it up in *another* worksheet (basically I don't want to clog up this second worksheet with all the machinery used to create this variable). Can this be done easily?
AlasdairSun, 09 Feb 2014 07:08:05 +0100https://ask.sagemath.org/question/11014/Declare arithmetic with formal variableshttps://ask.sagemath.org/question/10863/declare-arithmetic-with-formal-variables/I want to create variables in SAGE and and declare arithmetic relations between them. For example, it is easy enough to declare that x1, ..., xn and y1, ..., yn be variables. Is there a way to state that
xi*xj = 0 (in the ring of polynomials, if necessary)
or that
x1 < y1 < x2 < y2 < ...?
Zach HSat, 28 Dec 2013 00:50:04 +0100https://ask.sagemath.org/question/10863/Sage showed "TypeError: need a summation variable" when i used sum function with for loophttps://ask.sagemath.org/question/10674/sage-showed-typeerror-need-a-summation-variable-when-i-used-sum-function-with-for-loop/I try to make a summation list and the commands are below this:
> sage: var('n')
>
> sage: var('x')
>
> sage: f = (2/n)\*(sin(n\*x)\*(-1)^(n+1))
>
> sage: funclist = [sum(f,n,1,20) for n
> in range(1,3)]
but i found an error message:
> TypeError: need a summation variable
How to solve this problem?
terces907Wed, 30 Oct 2013 05:43:42 +0100https://ask.sagemath.org/question/10674/Difference Between Constants and Variableshttps://ask.sagemath.org/question/10583/difference-between-constants-and-variables/Hello all. I'm working with variational calculus in sage and working with
complicate expression `F` of a lot of variables declared with `var`.
I used `var` to declare both variables and constants. My problem is that I have
to know the exact number of variables which some generic expression depends. By
this reason the member function `variables` of an expression does not work, i.e.,
it returs both variables and constants because them was declared with `var` function.
I'm wondering if there is some type of variable in sage that can act as a variable to construct an expression and don't be returned by the `variables` member function.Rafael RojasTue, 08 Oct 2013 12:33:02 +0200https://ask.sagemath.org/question/10583/polynomial ring variable limit workaroundhttps://ask.sagemath.org/question/10377/polynomial-ring-variable-limit-workaround/
On my machine, the maximum number of variables allowed in a polynomial ring is 32767.
For instance,
S = PolynomialRing(QQ, 32767,'s')
works, but
S = PolynomialRing(QQ, 32768,'s')
does not.
Is there a workaround with enough functionality to allow me to do something like compute a primary decomposition of an ideal?
Patrick ClarkeWed, 31 Jul 2013 05:28:17 +0200https://ask.sagemath.org/question/10377/how to export vector variables and other data structures into R as variables?https://ask.sagemath.org/question/10380/how-to-export-vector-variables-and-other-data-structures-into-r-as-variables/All the examples I kind find here and in the documentation pass data from sage to R to be used once. I'd like to pass data that's in a sage (python) variable and turn it into an R variable that I can subsequntly use in %r codeblocks.
simple stuff like r.set('x', [1,2,3]) doesn't work because set expects a string. I could turn vectors into strings before passing them to set, but that's kind of klugy (and could be a pain for more complicated things.kjd45Tue, 23 Jul 2013 20:17:43 +0200https://ask.sagemath.org/question/10380/Turning an expression into a multivariate polynomial?https://ask.sagemath.org/question/10198/turning-an-expression-into-a-multivariate-polynomial/Suppose I have the expression
-a^3x^2 - a^2xy^2 + axy + bx^2 + 2bxy + xy^2
I want to turn this into a polynomial in x and y:
(1-a^2)xy^2+(a+2*b)xy+(b-a^3)x^2
so that I can then extract the coefficients (by setting x=1, y=1 in the list of operands of the new expression). How do I tell Sage which of the four variables will be the polynomial variables?AlasdairThu, 06 Jun 2013 00:57:36 +0200https://ask.sagemath.org/question/10198/How can I find out the name of some variable?https://ask.sagemath.org/question/10183/how-can-i-find-out-the-name-of-some-variable/Hello!
For example I have variable p in sage notebook. I need my class can find out the name of variable:
sage: p = 3
sage: my_class(p)
ans: 'p'
How to implement this feature? Thanks.
P.S.: sorry if my english isn't good.AndreWinWed, 05 Jun 2013 16:45:40 +0200https://ask.sagemath.org/question/10183/