1 | initial version |

In Python, you can read a string from the user prompt with the function `raw_input`

:

```
sage: a = raw_input()
2*x+3
sage: a
'2*x+3'
sage: type(a)
<type 'str'>
```

Then you can transform that string into a symbolic expression:

```
sage: b = SR(a)
sage: b
2*x + 3
sage: type(b)
<type 'sage.symbolic.expression.Expression'>
sage: sin(b)
sin(2*x + 3)
```

If you want to make something fancy, with input boxes and sliders, you can have a look at Sage `interact`

.

2 | No.2 Revision |

In Python, you can read a string from the user prompt with the function `raw_input`

:

```
sage: a = raw_input()
2*x+3
sage: a
'2*x+3'
sage: type(a)
<type 'str'>
```

Then you can transform that string into a symbolic expression:

```
sage: b = SR(a)
sage: b
2*x + 3
sage: type(b)
<type 'sage.symbolic.expression.Expression'>
sage: sin(b)
sin(2*x + 3)
```

You can put it within a function:

```
sage: def user_square():
....: print 'Please enter a function to be squared: ',
....: a = raw_input()
....: return SR(a)^2
sage: user_square()
Please enter a function to be squared: cos(d)+sin(t)
(cos(d) + sin(t))^2
```

If you want to make something fancy, with input boxes and sliders, you can have a look at Sage `interact`

.

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.