Usama Khan <usamazo...@gmail.com> wrote: > how to solve complex equation in pyhton? and then use it to make a program. > . i have created new post as my last post is i guessed ranked as a cheater. > .:(
> i know very litle about python as well as programing. . > which equation am taliking u will be thinking. . i am giving u the link > kindly c that equation. . n kindly let me know the way. . > https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.python/cxG7DLxXgmo First of all, the equation given there is unusable (even the number of parentheses doesn't match up). Propbably it's meant to be the one someone else posted a link to: http://classes.engr.oregonstate.edu/cce/winter2012/ce492/Modules/06_structural_design/06-3_body.htm This thingy can't be solved on paper so you need some iterative algorithm to find the solution. So waht you do is modify the equa- tion so that you have 0 on one side and then consider the other side to be a function of SN+1. Now the problem you're left with is to find the value(s) of SN+1 (and thus of SN) where the func- tion has a zero-crossing. A commonly use algorithms for finding zero-crossings is Newton's method. You can find lots of sites on the internet describing it in all neccessary detail. It boils down to start with some guess for the result and then calculate the next, better approximation via xn+1 = xn - f(xn) / f'(xn) where f(xn)n) is the value of the function at point xn and f'(xn) the value of the derivative of f (with respect to x) also at xn. You repeat the process until the difference be- tween xn an the next, better approximation, xn+1, has become as small as you need it. So it's very simple to implement and the ugliest bit is pro- bably calculating the required derivative of the function with respect to SN+1 (wbich you can take to be x). Regards, Jens -- \ Jens Thoms Toerring ___ j...@toerring.de \__________________________ http://toerring.de -- http://mail.python.org/mailman/listinfo/python-list