# Error if lambdify target function is zero

**URL:** <https://discourse.julialang.org/t/error-if-lambdify-target-function-is-zero/128587>\
**Category:** General Usage\
**Tags:** sympy\
**Created:** [May 1, 2025, 1:31am UTC](https://discourse.julialang.org/t/error-if-lambdify-target-function-is-zero/128587 "2025-05-01T01:31:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![inkie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/inkie/32/216606_2.png) [@inkie](https://discourse.julialang.org/u/inkie)\
**Post date:** [May 1, 2025, 1:31am UTC](https://discourse.julialang.org/t/error-if-lambdify-target-function-is-zero/128587/1 "2025-05-01T01:31:57Z")

</div>

Hi guys, im implementing the fourier functions in julia + sympy but when i have an odd function my bn is not working as expected since bn(1) for example is not working giving this error: MethodError: no method matching (::SymPyCore.var"#260#261")(::Int64)

this is my code i could just remove the bn value but i was thinking if there is a workaround for this

```julia
begin
	x,y = symbols("x y", real=true)
	n = symbols("n", integer=true, positive=true)
	
	a0_sym = (1/(2*PI)) * (integrate(Sym(1),(x,-PI/2, PI/2))) 
	an_sym = (1/PI) *(integrate(cos(n*x),(x,-PI/2,PI/2))) |>simplify
	bn_sym = (1/PI)*(integrate(sin(n*x), (x, -PI/2, PI/2))) |> simplify
	
	a0 = a0_sym.evalf() 
	an = lambdify(an_sym) 
	bn = lambdify(bn_sym) 
	
	# Rango de x
	xs = range(-π, π, length=500)

	function fourier(x; N=5)
		y = a0
		for n in 1:N
			y += an(n)*cos(n*x) + bn(n)*sin(n*x)
		end
		return y
	end

	bn(1)
end

```

---

<div class="post-metadata">

**Author:** ![j\_verzani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_verzani/32/8551_2.png) [@j\_verzani](https://discourse.julialang.org/u/j_verzani)\
**Post date:** [May 1, 2025, 3:37am UTC](https://discourse.julialang.org/t/error-if-lambdify-target-function-is-zero/128587/2 "2025-05-01T03:37:01Z")

</div>

Can you post an issue?

---

<div class="post-metadata">

**Author:** ![j\_verzani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_verzani/32/8551_2.png) [@j\_verzani](https://discourse.julialang.org/u/j_verzani)\
**Post date:** [May 1, 2025, 9:34pm UTC](https://discourse.julialang.org/t/error-if-lambdify-target-function-is-zero/128587/4 "2025-05-01T21:34:56Z")

</div>

This behavior is changed with a just tagged version of `SymPyCore`.
