# Question:NonlinearFit and complex value encountered - How do I get around this?

## Question:NonlinearFit and complex value encountered - How do I get around this?

Maple 18

I have some data

> X:=[291.3301386,349.9410125,420.7945287,490.0836935,558.1365585,623.6824877,688.6344191,752.1359797,814.1871695,874.7879884,933.8452525,991.0023402,1047.88822,1102.687556,1156.036521,1207.200419]:

>
> Y:=[0.008923638,0.010336322,0.012031554,0.013676089,0.01527851,0.016809936,0.018315901,0.019777093,0.021194266,0.022568158,0.023897399,0.025174796,0.026437267,0.027645069,0.02881302,0.029925828]:

to which I am trying to fit a function

U:=(m,d,Theta,T)-> (((3*(6.62607e-34)^2*T)/(4*Pi^2*m*1.36085e-23*Theta^2))*((T/Theta)*int(x/(exp(x)-1),x=0..Theta/T) + (Theta/(4*T))))/1e-10^2 +d^2;

where Theta≈200 and d≈0.035. T, Theta, d, m > 0

When I try and solve

> NonlinearFit(U(0.15036/6.022e23,d,Theta,T),X,Y,T,initialvalues=[Theta=200, d=0.035]);

I get the error "Error, (in Statistics:-NonlinearFit) complex value encountered"

I can plot the function with Theta=200 and d=0.035, I get approximately the right curve and no errors about complex values.

How can I solve for Theta and d without encountering this error?

﻿