Modeling Complex Mathematical Reasoning via Large Language Model based MathAgent