how to solve complex equation?

Discussion in 'Python' started by Usama Khan, Jan 1, 2013.

  1. Usama Khan

    Usama Khan Guest

    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
    Usama Khan, Jan 1, 2013
    #1
    1. Advertising

  2. Usama Khan <> 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 ___
    \__________________________ http://toerring.de
    Jens Thoms Toerring, Jan 1, 2013
    #2
    1. Advertising

  3. On Wed, Jan 2, 2013 at 6:02 AM, Usama Khan <> 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. .:(


    1) Do you mean complex or complicated? Be strict with your language,
    lest you get completely wrong answers. Python *does* have support for
    complex numbers, but I don't think you need them here. (I may be wrong
    (again), though.)

    2) Put some more thought into your posts. You're coming across
    sounding very sloppy. We're all on the internet, so we know how to
    read through typos, but a proliferation of them in a message with no
    capitalization, SMS abbreviations ("u" for "you"... congrats, you
    saved two whole keystrokes there - four, since you did that twice),
    etc, adds up to an overall picture of someone who cares little about
    how the posts come across.

    3) We are all volunteers. Python-list gets a goodly amount of traffic
    every day. If you want a response, you need to make your post look
    interesting, fun, or productive (preferably more than one of the
    above). Make it look like we're going to spend a huge amount of time
    helping a black hole is one of the best ways to get ignored.

    http://www.catb.org/esr/faqs/smart-questions.html

    Since you haven't read that link from last time I posted it, I'll take
    the liberty of quoting a portion of its introduction.

    """If you give us an interesting question to chew on we'll be grateful
    to you; good questions are a stimulus and a gift. ...What we are,
    unapologetically, is hostile to people who seem to be unwilling to
    think or to do their own homework before asking questions. People like
    that are time sinks — they take without giving back, and they waste
    time we could have spent on another question more interesting and
    another person more worthy of an answer. We call people like this
    “losers” (and for historical reasons we sometimes spell it
    “lusers”)."""

    If you want a response, don't look like a loser.

    ChrisA
    Chris Angelico, Jan 1, 2013
    #3
  4. Usama Khan

    Gary Herron Guest

    On 01/01/2013 11:02 AM, Usama Khan 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


    Please STOP asking this question, and try to understand the answers you
    have already been given.

    Short answer: This is NOT a python question, and you can't solve it in
    Python.

    Longer answer: This is a math question. Some equations can be solved
    with algebra, and some can't, in which case perhaps you need some sort
    of a technique for numerical approximation. Other's have indicated
    that your problem probably falls into the later category. What YOU
    need to do is investigate iterative techniques for numerical solutions
    and pick one. (And this Python list is CERTAINLY the wrong place for
    such math questions.) Once you know what solution technique you want to
    use, you could then come back to this group and ask for help
    implementing it.

    P.S. I have implemented several such techniques, and I have taught
    college courses involving such techniques, and I'll say this: What you
    ask is the subject of AT LEAST several hours of lectures and possibly
    several semesters worth of study. No one is going to put that kind of
    time into answering your question here.

    --
    Dr. Gary Herron
    Department of Computer Science
    DigiPen Institute of Technology
    (425) 895-4418
    Gary Herron, Jan 1, 2013
    #4
  5. Usama Khan

    alex23 Guest

    On Jan 2, 5:02 am, Usama Khan <> wrote:
    > i have created new post as my last post is i guessed ranked as a cheater..:(


    Don't do this. Starting new threads on the same subject because you're
    not happy with the response you're getting elsewhere is a surefire way
    to end up in a lot of killfiles.

    > i know very litle about python as well as programing. .


    Then please stop asking people to write your code for you. For many of
    us. this is our *profession*. Generally, we're here to help others &
    ourselves understand Python better, not to work for free. If you don't
    have the time or the ability to produce what you want, and it has
    value to you, then offer to *pay* someone for their time & effort in
    writing the code for you.
    alex23, Jan 1, 2013
    #5
  6. Usama Khan

    Usama Khan Guest

    thanks :)

    no issues. . :)

    sorry for wasting ur precious time. . .sorry once again. .


    its mine problem now. . neither python. .nor the algebra. . .

    sorry guys. dont mind. .:) dont get me wrong. .
    Usama Khan, Jan 1, 2013
    #6
  7. Usama Khan

    someone Guest

    On 01/01/2013 10:49 PM, Jens Thoms Toerring wrote:
    > Usama Khan <> 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).


    Exactly. I think a 5th semester engineering student should know this. If
    not, it's not the python-skills that is the problem. It's the (lack of)
    mathematical insight.

    I think maybe the OP should not demand people here to "show the
    solution", but begin with something much simpler and then as he becomes
    better and better with python, he can move towards more programmatically
    advanced code.

    The basic idea about an iterating loop, defining an objective function
    etc is not really advanced python.

    But I think the OP should start out with something more simple than what
    he tries to do here.

    Just starting out by iteratingly finding the solution to x^2-9 = 0 is a
    great starting place.

    After having studied, googled python examples on the internet, I think
    most people should be able to solve x^2-9=0 in a day for a guy who knows
    about programming in an arbitrary programming language other than python.

    It looks like laziness, when we don't see any attempts to show what has
    been tried to do, from the OP's point of view.

    The best way to get good feedback (IMHO) is to post some code and then
    post any errors/warnings that python is giving back.

    Don't just write: "Give me the code for doing this".
    someone, Jan 2, 2013
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Zimmerman
    Replies:
    0
    Views:
    927
    David Zimmerman
    Jun 27, 2003
  2. pete kirkham
    Replies:
    0
    Views:
    2,014
    pete kirkham
    Jun 27, 2003
  3. Chris Smith
    Replies:
    1
    Views:
    5,497
    Dale King
    Jun 30, 2003
  4. purple
    Replies:
    2
    Views:
    300
    Gabriel Genellina
    Mar 19, 2008
  5. Replies:
    5
    Views:
    89
Loading...

Share This Page