# Desattribution of a value to a variable

Suppose I have attributed to `a`

the value 3. But for the following operation I want to use anew `a`

as a variable how should I operate, redefine `a`

?

Desattribution of a value to a variable

`a`

the value 3. But for the following operation I want to use anew `a`

as a variable how should I operate, redefine `a`

?

add a comment

1

A Python name is just a pointer to a Python/Sage object:

```
sage: a = 3
sage: a+a
6
```

Now, if you redefine it, it will just point to the new object:

```
sage: a = 12
sage: a
12
sage: a^2
144
```

If you want the symbol `a`

(not to be confused with the Python name `a`

), you can do:

```
sage: SR.var('a')
a
```

Any Python name can point to such symbol:

```
sage: b = SR.var('a')
sage: b
a
sage: (b+1)^2
(a + 1)^2
```

What confuses most people is that the shortcut:

```
sage: var('a')
a
```

both returns the symbol `a`

and let the Python name `a`

point to this symbol, in particular, it removes the previous pointer of the Python name `a`

:

```
sage: a # this a is a Python name
a # this a is a symbol, pointed bythe previous Python name
```

Asked: **
2020-05-12 09:53:36 -0600
**

Seen: **38 times**

Last updated: **May 12 '20**

Extending piecwise to 2 variables (or a variable and a parameter)

Evaluation of a function and it's inverse with parameters

How to tell to sagemath to solve for the good root

Is it possible to substitute $U^\prime$ to $D_0(U)$ ?

sagemath fails to solve an equation and inequation

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.