# Not sure how to generate ForwardDiff function

**URL:** <https://discourse.julialang.org/t/not-sure-how-to-generate-forwarddiff-function/51030>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package, forwarddiff, calculus\
**Created:** [December 1, 2020, 5:31am UTC](https://discourse.julialang.org/t/not-sure-how-to-generate-forwarddiff-function/51030 "2020-12-01T05:31:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brett\_knoss](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brett_knoss/32/13050_2.png) [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Post date:** [December 1, 2020, 5:31am UTC](https://discourse.julialang.org/t/not-sure-how-to-generate-forwarddiff-function/51030/1 "2020-12-01T05:31:40Z")

</div>

I try to run this, but it says there is a format problem, I think with line 3 (fp(x))

```julia
using ForwardDiff
f(x)=x^6-2
fp(x) = x->ForwardDiff.derivative(f, x)
x=1.5
x=x-(f(x)/fp(x))

```

---

<div class="post-metadata">

**Author:** ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Post date:** [December 1, 2020, 6:01am UTC](https://discourse.julialang.org/t/not-sure-how-to-generate-forwarddiff-function/51030/2 "2020-12-01T06:01:21Z")

</div>

remove the `x->`, i.e., do

```julia
fp(x) = ForwardDiff.derivative(f, x)

```
