# Avoid problem fitting Complex part of equation with FindFit?

GROUPS:
 Hi, I am Prady and I am new to Mathematica. I have just started using it for my project work. I have to fit Havriliak Negami Equation to my experimental results. When I take the real part and use FindFit, it is fitting correctly. I have included this in the file Real_part.nb. However, when I include the complex part it is giving error . This error can be seen in Real+Imag_part.nb. Kindly advise which function to use instead of FindFit or provide a solution. Thank you. Attachments:
1 year ago
5 Replies
 There may be an issue with symbols and the order of evaluation. You give a numerical value for Subscript[\[Epsilon], s], then you give s the value 1. If you evaluate \[Epsilon][\[Omega], \[Gamma], \[Tau], z, \[Sigma]] you will see that it contains Subscript[\[Epsilon], 1], which has no numerical value. Did you mean Subscript[\[Epsilon], s] to be a single symbol, with s to be kept symbolic and not to be replaced by 1? If so, you should write it differently to avoid the problem. For example \[Epsilon]s.
1 year ago
 Sander Huisman 1 Vote As I have said before http://community.wolfram.com/groups/-/m/t/854634 , Subscript should only be used as a typographical construct. One will sooner or later get in to trouble with variables with subscripts using the Subscript function.
 Unfortunately you have run into a shortcoming of Mathematica. FindFit seems to have been programmed with the real case in mind. The complex case works in some simple examples such as FindFit[{I, 2, 3}, a*x , {a}, x] FindFit[{1, 2 + I, 3}, a *x, a, x] FindFit[{1, 2, 3}, a x + I , a, x] but it fails with little variations: FindFit[{I, 2, 3}, Cos[a] , {a}, x] FindFit[{1, 2 + I, 3}, {a *x, {0 < Re[a] < 1}}, a, x] FindFit[{1, 2, 3}, {a x + I, {0 < a < 1}} , a, x]