Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!postnews.google.com!u14g2000yqg.googlegroups.com!not-for-mail From: Mars creature <jinbow@gmail.com> Newsgroups: comp.soft-sys.matlab Subject: Re: finding complex root from nonlinear equations Date: Sun, 4 Jan 2009 08:21:45 -0800 (PST) Organization: http://groups.google.com Lines: 38 Message-ID: <f5f45956-b72f-4637-abec-c6ad168c231c@u14g2000yqg.googlegroups.com> References: <046c08c7-878f-4967-bab1-41273a92bcbd@r2g2000vbp.googlegroups.com> <gjoq0t$4h3$1@fred.mathworks.com> NNTP-Posting-Host: 18.83.6.116 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1231086105 18663 127.0.0.1 (4 Jan 2009 16:21:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 4 Jan 2009 16:21:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u14g2000yqg.googlegroups.com; posting-host=18.83.6.116; posting-account=_4K9ngoAAABVZJw3RN5UjOi497cBl1P9 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.14) Gecko/20080416 Fedora/2.0.0.14-1.fc8 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Xref: news.mathworks.com comp.soft-sys.matlab:509754 On Jan 3, 5:49 pm, "Roger Stafford" <ellieandrogerxy...@mindspring.com.invalid> wrote: > Mars creature <jin...@gmail.com> wrote in message <046c08c7-878f-4967-bab= 1-41273a92b...@r2g2000vbp.googlegroups.com>... > > Hi Matlab users, > > I know fsolve can find the real roots from polynomial equations, but > > I don't know how to find complex roots, like x^2+1=3D0. Also I have a > > complicated nonlinear equation with complex coefficients to solve > > numerically, anyone give me a hint where to find the instruction? > > Thank you very much! > > JB wang > > For polynomial equations the matlab function 'roots' will find all root= s, complex or real. For general nonlinear equations, Mathworks' advice in = their 'fsolve' documentation is "fsolve only handles real variables. When x= has complex variables, the variables must be split into real and imaginary= parts." Presumably this splitting would also apply to the values in the f= unction F(x) to be zero-ed. Its real and imaginary parts could be brought = to zero as separate elements of the F(x) vector. In effect you would be do= ubling the number of unknowns and the number of equations. > > As to finding all possible roots, 'fsolve' only promises to find one ro= ot. However that can be manipulated by selecting differing starting values= on different calls to 'fsolve'. That might be easier said than done, thou= gh. > > Roger Stafford Thanks Roger, This is helpful. I can see that polynomial equations can be split into two equations containing the real and imag parts. However, it might be a problem for more complicated nonlinear equations, like including sin/cos and sqrt of x and even more complicated cases, when the whole equation is not easy to split. I was wondering if there's solver like fsolve, and can find the complex roots without splitting the equation. I googled but can not find very useful information. Thank you very much!! JB wang