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.Mon, 10 Oct 2016 20:28:44 +0200assign variable valuehttps://ask.sagemath.org/question/35110/assign-variable-value/ Hi!
I'm just getting started with Sage and therefore my question may sound really stupid (and nevertheless I couldn't find an answer here).
I have a matrix with both symbolic entries and numerical values, let's say:
a,b=var('a,b')
M=matrix([[1,a], [0,b]])
Now I want do assign a value to a:
a=0
However if I print M to the screen it still says a in the matrix and not 0.
You can clearly see that I'm really not used to Sage, so what's the problem here?
What should I do if I want to assign a fixed value to a variable which is also used in the calculations where this variable appears?
Thank's for the answers, I know this will sound highly trivial for you!
Philippphilipp7Mon, 10 Oct 2016 20:28:44 +0200https://ask.sagemath.org/question/35110/Assigning variables in a listhttps://ask.sagemath.org/question/27056/assigning-variables-in-a-list/I have a variables list which I use to construct a system of linear equations then I use sage to solve this system. Before I use the solve command I like to equate some of the variables in the list. For example if V is the following list `var('x,y,z,w,a,b,c,d')
V2=[x,y,z,w,a,b,c,d]`
I would like to assign`V[i]=V[7-i] for i in [0..3]`. When I do this I get invalid syntax error. I know that I could easily set x=d, y=c and so on but this is not feasible when the list has too many items in it. Thank you for your help!cihanMon, 08 Jun 2015 21:52:51 +0200https://ask.sagemath.org/question/27056/