# Symbolic sqrt(2) and sin(pi)

**URL:** <https://discourse.julialang.org/t/symbolic-sqrt-2-and-sin-pi/58633>\
**Category:** Specific Domains\
**Tags:** symbolic\
**Created:** [April 4, 2021, 7:03pm UTC](https://discourse.julialang.org/t/symbolic-sqrt-2-and-sin-pi/58633 "2021-04-04T19:03:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![oscarbenjamin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscarbenjamin/32/22868_2.png) [@oscarbenjamin](https://discourse.julialang.org/u/oscarbenjamin)\
**Post date:** [April 5, 2021, 8:07am UTC](https://discourse.julialang.org/t/symbolic-sqrt-2-and-sin-pi/58633/5 "2021-04-05T08:07:30Z")

</div>

> [@CAS Best Practices](https://discourse.julialang.org/t/cas-best-practices/58092/69):
>
> ```julia
> julia> using Symbolics
> julia> Term(sqrt,[2])
> sqrt(2)
> 
> ```
> 
> I don’t get why you’d work harder than that.

Okay so:

```julia
julia> using Symbolics
[Info: Precompiling Symbolics [0c5d862f-8b57-4792-8d23-62f2024744c7]

julia> Term(sqrt, [2])
ERROR: UndefVarError: Term not defined
Stacktrace:
 [1] top-level scope at REPL[1]:1

julia> Symbolics.Term(sqrt,[2])
sqrt(2)

```

Am I supposed to spell the `using` differently to make `Term` accessible (apart from just `using Symbolics: Term`)?

It seems that `Term` works more or less as I would expect for element:

```julia
julia> expr = Term(sqrt,[2])
sqrt(2)

julia> expr * expr
sqrt(2)^2

julia> expr * expr + 1
1 + sqrt(2)^2

julia> @syms x
(x,)

julia> expr2 = x + expr
x + sqrt(2)

```

However if I now substitute an exact value for `x` I get a floating-point result:

```julia
julia> substitute(expr2, Dict([x => 0]))
1.4142135623730951

```

How can I:

1. Explicitly request for an expression like `sqrt(2)` to evaluate to an approximate floating point result with some specified precision/digits
2. Prevent the numerical evaluation when performing an exact substitution.
3. Evaluate something like `sin(pi)` exactly.

(Feel free to point to any docs that explain this but I’ve skimmed them and I don’t see these things explained or any mention of `Term`.)

---

_[View the full topic](https://discourse.julialang.org/t/symbolic-sqrt-2-and-sin-pi/58633)._
