[SciPy-user] questions about solving equations in scipy

fdu.xiaojf at gmail.com fdu.xiaojf at gmail.com
Wed Jun 13 03:37:04 EDT 2007


Hi all,

I have posted this to python-list, and some people kindly pointed that here is 
a better place for scipy related questions.

I have two questions about scipy.

1) When I was trying to solve a single variable equations using scipy, I
found two methods: scipy.optimize.fsolve,and scipy.optimize.newton.

I have tried both, and it seemed that both worked well, and fsolve ran
faster.

My questions is, which is the right choose ?

And I also found that there are models and functions in both scipy and numpy, 
such as scipy.linalg.solve() and numpy.linalg.solve(), and both can solve a 
linear equation. Are they the same in the ground?

2) I have to solve a linear equation, with the constraint that all
variables should be positive. Currently I can solve this problem by
manually adjusting the solution in each iteration after get the solution
bu using scipy.linalg.solve().

I found a web page about optimization solver in 
openoffice(http://wiki.services.openoffice.org/wiki/Optimization_Solver#Non-Linear_Programming).
  Openoffice has an option of "Allow only positive values", so I think that 
may be a well-defined problem. Sorry for my ignorance if I was wrong.

Is there a smart way in python?

Thanks in advance.

Xiao Jianfeng




More information about the SciPy-User mailing list