J added as a parameter inside fsolve in te_pair.py to make J_error equal to zero