How can I evaluate a Julia function with sin/cos as real value?

Hi everyone, I have a Julia function like f(x) = x + sin(x), and then I try to type f(2), which returns 2 + sin(2). I think it is great, but is there anything to make it returns a single real number?

Thank you. It would be great if someone can help.

That does not make sense to me.

julia>  f(x) = x + sin(x)
f (generic function with 1 method)

julia> f(2)
2.909297426825682

What exactly is your function f? How is it defined?

2 Likes