2 # This is a rough approach to fit a model function to the density
3 # data of a liquid crystal. The function consists of a linear
4 # branch for the high temperature region and of a curved branch with
5 # linear asymptote for the low temperatuer branch
9 # m1, m2 slopes of the linear function in the low and high T region
10 # Tc transition temperature
11 # dens_Tc density at the transition temperature
12 # g factor to scale tanh function
22 high(x) = mh*(x-Tc) + dens_Tc
23 lowlin(x) = ml*(x-Tc) + dens_Tc
24 curve(x) = b*tanh(g*(Tc-x))
26 density(x) = x < Tc ? curve(x)+lowlin(x) : high(x)