# drawing the function y = |log x|

When drawing the function y = |log x|, I know that x must be positive but I have varied x from -5 to 5 by habit. I had no error message and a graph having a part in the box x<0. I would have liked to attach the graphic but that is denied me.

```
def y(x):
return abs(log(x))
G = plot(y, (-5,5), color='blue')
G.show(aspect_ratio=1, axes = True, gridlines=True, ymin = -1, ymax = 6)
```

Hint: try

`log(-3)`

etc. and see what comes out.Just click here for the graphic!

Although most people learn the logarithm has domain positive reals and range all reals the logarithm, like other functions such as e^x, gets extended to the complex number system. Type: log? on the command line for Sage to see further down: "The log function works for negative numbers, complex numbers, and symbolic numbers too, picking the branch with angle between -pi and pi". Since the absolute value of a complex number is just its distance from the origin Sage has done everything correctly.

Thank you very much for the answers. They show me that I still have to study a lot Sage.