1 | initial version |

This question looks like homework, so it could be nice to tell us where is the point you are stuck. Here are some hints: if you want to pick a number between 0 and 1 uniformly at random, just type:

```
sage: random()
0.49232726718735065
```

Now, what you have to do is to compare this value to `f(x)`

. For this, you have to know that Sage uses the Python programming language, so you can look for tutorials about "if statement" in Python.

Please tell us if you encounter difficulties (and do not hesitate to post your code and where it does not work).

2 | No.2 Revision |

This question looks like homework, so it could be nice to tell us where is the point you are stuck. Here are some hints: if you want to pick a number between 0 and 1 uniformly at random, just type:

```
sage: random()
0.49232726718735065
```

Now, what you have to do is to compare this value to `f(x)`

. For this, you have to know that Sage uses the Python programming language, so you can look for tutorials about "if statement" in Python.

Please tell us if you encounter difficulties (and do not hesitate to post your code and where it does not ~~work).~~work), so that we can help further.

3 | No.3 Revision |

This question looks like homework, so it could be nice to tell us where is the point you are stuck. Here are some hints: if you want to pick a number between 0 and 1 uniformly at random, just ~~type:~~use the `random()`

function:

```
sage: random()
0.49232726718735065
```

Now, what you have to do is to compare this value to `f(x)`

. For this, you have to know that Sage uses the Python programming language, so you can look for tutorials about "if statement" in Python.

Please tell us if you encounter difficulties (and do not hesitate to post your code and where it does not work), so that we can help further.

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.