def f(t,tc,bmag):
if (tc<0 and bmag<0):
Tcnew = -tc/3
Bmagnew = -bmag/3
if (t/Tcnew<=1):
return 1-(79/140/0.4/(t/tc) + 474/497*(1/0.4-1)*((t/tc)**3/6 + (t/tc)**9/135+(t/tc)**15/600))/A
elif (t/Tcnew<1):
return (-1/10/(t/tc)**5 - 1/315/(t/tc)**15 - 1/1500/(t/tc)**25)/A
elif (t/tc>0 and t/tc<=1):
return 1-(79/140/0.4/(t/tc) + 474/497*(1/0.4-1)*((t/tc)**3/6 + (t/tc)**9/135+(t/tc)**15/600))/A
elif (t/tc>1):
return (-1/10/(t/tc)**5 - 1/315/(t/tc)**15 - 1/1500/(t/tc)**25)/A