# Numeric Substitution Issue in build\_function (expression=Val{false})

**URL:** <https://discourse.julialang.org/t/numeric-substitution-issue-in-build-function-expression-val-false/126202>\
**Category:** New to Julia\
**Tags:** question, package, symbolics\
**Created:** [February 23, 2025, 7:51am UTC](https://discourse.julialang.org/t/numeric-substitution-issue-in-build-function-expression-val-false/126202 "2025-02-23T07:51:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikram\_backup](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vikram_backup/32/202851_2.png) [@vikram\_backup](https://discourse.julialang.org/u/vikram_backup)\
**Post date:** [February 23, 2025, 7:51am UTC](https://discourse.julialang.org/t/numeric-substitution-issue-in-build-function-expression-val-false/126202/1 "2025-02-23T07:51:50Z")

</div>

Consider the simple code which defines a function of `x` using `build_function`

```julia
using Symbolics

@variables x
expr = exp(im*x)*cos(x)

# The option expression=Val{false} is supposed to force numerical evaluation.
f = build_function(expr, [x], expression=Val{false})

# Try to call the generated function with a numerical value.
result = f(0.8)
println("Result: ", result)

```

Ideally the result should be `0.48540023884935557 + 0.49978680152075255im` but I get the output in terms of the symbolic variable `Result: cos(x)^2 + im*sin(x)*cos(x)`

I want the code to finally output a number. How can I fix this?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 23, 2025, 5:18pm UTC](https://discourse.julialang.org/t/numeric-substitution-issue-in-build-function-expression-val-false/126202/2 "2025-02-23T17:18:45Z")

</div>

This looks like it’s a bug. Please file an issue and we’ll take a look. My guess is that some dispatch is on `Real` instead of `Number` so complex numbers are doing something odd.
