# Can I use custom Constant Values in SAGE?

show(pi) will show a nice representation of pi, while pi.n() will yield a useable value

how am I supposed to achieve the same functionality for a custom 'symbol' ?

like

Az = 5.5 # cm the surface area of my Cylinder

but showing 'Az' as representation, not the value

I solved this with a custom Class, but this feels wrong:

```
class Myconst(Constant):
def __init__(self, name='Az', value=1.0):
Constant.__init__(self, name,
latex=None, domain='positive')
self.v = value
def __float__(self):
return self.v
def _real_double_(self, R):
return self.v
def _mpfr_(self,R):
return self.v
Az = Myconst(name='Az', value = 2.0).expression()
#As = Myconst(name='As', value = 5.0).expression()
```

now these work like I want them to :) Az.n() show(1/Az)

But is this the intended approach?

If it is a short life constant, than the above is ok.

Else, one has to integrate the constant with the sage code, this does not seem to be easy:

and so on.

`pi??`

gives more information. (Or just open the py-file...)Note: To have in-line code displayed as code, use the ticks to markdown. (Or mark it in editor and press either Control+K or that button with

`101`

and`010`

.)