# Calculating inverse of a function

Is there any straightforward way to calculate inverse of a function in sage? For example:

```
f(x) = 2 * x - 1
f^-1(x) = ( x + 3 ) / 2
```

I have encountered solutions like this. But this was answered 9 years ago, I hope there exist a better way to do now.