# Answer Question

### How can i define a function within a component fortran script

Hello,

I'm trying to create a component that computes zeros using newton raphson. The idea is that i define a function and its derivative and pass in an initial guess and the output will be the root.

I'm trying to develop this first with a dummy example f(x) = x^2 - 9

I wrote a script in fortran section of component design, and i'm having issues with it . I'm relatively new to PSCAD and fortran so any help/tips would be really helpful.

I've attaced an image of code and the model im using.

I'm trying to create a component that computes zeros using newton raphson. The idea is that i define a function and its derivative and pass in an initial guess and the output will be the root.

I'm trying to develop this first with a dummy example f(x) = x^2 - 9

I wrote a script in fortran section of component design, and i'm having issues with it . I'm relatively new to PSCAD and fortran so any help/tips would be really helpful.

I've attaced an image of code and the model im using.