segmentation fault with some equations solved