Results 1 to 4 of 4

Math Help - Solver for a system of nonlinear equations

  1. #1
    Newbie
    Joined
    Nov 2007
    Posts
    7

    Lightbulb Solver for a system of nonlinear equations needed

    Hi everyone,

    I am trying to solve a nonlinear system of 12 equations for 12 unknowns.
    (For the purpose of verifying, all the exact value of unknowns are available)

    I have tried:

    1. The function "solve" in Matlab.
    2. The secant method for simultaneous nonlinear equations (by Philip Wolfe, 1959).

    But both of them gave me wrong answer.

    Could you please kindly help tell me

    1. How can I find out whether the equations in the system are independent?
    2. Are there any other functions or method which can be used to solve this system of nonlinear equations.

    Thank you very much for your time.
    Last edited by tvauce; February 26th 2008 at 01:26 AM. Reason: add more information
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by tvauce View Post
    Hi everyone,

    I am trying to solve a nonlinear system of 12 equations for 12 unknowns.
    (For the purpose of verifying, all the exact value of unknowns are available)

    I have tried:

    1. The function "solve" in Matlab.
    2. The secant method for simultaneous nonlinear equations (by Philip Wolfe, 1959).

    But both of them gave me wrong answer.

    Could you please kindly help tell me

    1. How can I find out whether the equations in the system are independent?
    2. Are there any other functions or method which can be used to solve this system of nonlinear equations.

    Thank you very much for your time.
    Are you trying to solve these numericaly or symbolicaly?

    Can you post your matlab code?

    RonL
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Nov 2007
    Posts
    7
    Thank you very much for your response
    I am trying to find numerical solution.
    In Matlab:
    +12 equations with 12 unknowns from x1 to x12 (dt=0.01 known)
    f1 = x1*x11 + x2*x12 + x5*x9 + x6*x10;
    f2 = x3*x11 + x4*x12 + x7*x9 + x8*x10;
    f3 = x1*x11 + 0.0019*dt*x1 + x2*x12 + 0.8960*dt*x2 + x5*x9 + dt*x5*x11 + 0.001*dt^2*x5 + x6*x10 + dt*x6*x12 + 0.4480*dt^2*x6 + 0.3828;
    f4 = x3*x11 + 0.0019*dt*x3 + x4*x12 + 0.8960*dt*x4 + x7*x9 + dt*x7*x11 + 0.001*dt^2*x7 + x8*x10 + dt*x8*x12 + 0.4480*dt^2*x8 - 0.3844;
    f5 = x1*x11 + 0.0080*dt*x1 + x2*x12 + 1.8396*dt*x2 + x5*x9 + 2*dt*x5*x11 + 0.0059*dt^2*x5 + x6*x10 + 2*dt*x6*x12 + 1.8158*dt^2*x6 + 0.8342;
    f6 = x3*x11 + 0.0080*dt*x3 + x4*x12 + 1.8396*dt*x4 + x7*x9 + 2*dt*x7*x11 + 0.0059*dt^2*x7 + x8*x10 + 2*dt*x8*x12 + 1.8158*dt^2*x8 - 0.8412;
    f7 = x1*x11 + 0.0189*dt*x1 + x2*x12 + 2.8060*dt*x2 + x5*x9 + 3*dt*x5*x11 + 0.0193*dt^2*x5 + x6*x10 + 3*dt*x6*x12 + 4.1386*dt^2*x6 + 1.3449;
    f8 = x3*x11 + 0.0189*dt*x3 + x4*x12 + 2.8060*dt*x4 + x7*x9 + 3*dt*x7*x11 + 0.0193*dt^2*x7 + x8*x10 + 3*dt*x8*x12 + 4.1386*dt^2*x8 - 1.3620;
    f9 = x1*x11 + 0.0351*dt*x1 + x2*x12 + 3.7696*dt*x2 + x5*x9 + 4*dt*x5*x11 + 0.0463*dt^2*x5 + x6*x10 + 4*dt*x6*x12 + 7.4264*dt^2*x6 + 1.9038;
    f10 = x3*x11 + 0.0351*dt*x3 + x4*x12 + 3.7696*dt*x4 + x7*x9 + 4*dt*x7*x11 + 0.0463*dt^2*x7 + x8*x10 + 4*dt*x8*x12 + 7.4264*dt^2*x8 - 1.9365;
    f11 = x1*x11 + 0.0571*dt*x1 + x2*x12 + 4.7050*dt*x2 + x5*x9 + 5*dt*x5*x11 + 0.0924*dt^2*x5 + x6*x10 + 5*dt*x6*x12 + 11.6637*dt^2*x6 + 2.4984;
    f12 = x3*x11 + 0.0571*dt*x3 + x4*x12 + 4.7050*dt*x4 + x7*x9 + 5*dt*x7*x11 + 0.0924*dt^2*x7 + x8*x10 + 5*dt*x8*x12 + 11.6637*dt^2*x8 - 2.5533;

    when using "solve" function in Matlab, no code is needed
    when using the Secant method, the code is as follows
    dt=1e-2;
    % initial values for variables
    varc=[120,-40,-40,40]; vark=[1600,-600,-600,600]; var=[];
    for i =1:25
    [var]=[var;[awgn(varc,20,'measured')],[awgn(vark,20,'measured')],[ 0.01*randn(1,4)], [0.1*randn(1,12)]];
    end
    k=12;tol=1e-6; ndof=2; ns=1; B=zeros(1,24); B=[B,1]'; neq=ns*k; % (neq is the number of equations)
    [A]=A2dofs(var,ndof,dt);
    [A]=[A;ones(1,k+1)];
    n=zeros(k+1,1); for ii=1:length(n) n(ii)=norm(A(1:neq,ii)); end
    xx=var; e1=max(n); % save result for visualization purpose
    for jj=1:500
    p=A\B;
    var_bar=p'*var;
    pp=[A2dofs(var_bar,ndof,dt);1];
    % Find the column which have maximal norm and replace:
    [maxn,Imax]=max(n);
    [minn,Imin]=min(n);
    var(Imax,=var_bar;
    A(:,Imax)=pp;
    n(Imax)=norm(pp(1:neq,1));
    err1=norm(var_bar-var(Imin,);
    err2=n(Imax); [e1]=[e1,max(err1,err2)];
    iter=jj;
    [xx]=[xx;var_bar];
    if (err1<tol) & (err2<tol)
    break
    end
    end

    Where A2dofs is simply the m-file to evaluate the value of the 12 functions at certain value of x1 to x12.
    If possible, pls contact me directly through my email: g0500479@nus.edu.sg
    Thank you very much.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by tvauce View Post
    Thank you very much for your response
    I am trying to find numerical solution.
    In Matlab:
    +12 equations with 12 unknowns from x1 to x12 (dt=0.01 known)
    f1 = x1*x11 + x2*x12 + x5*x9 + x6*x10;
    f2 = x3*x11 + x4*x12 + x7*x9 + x8*x10;
    f3 = x1*x11 + 0.0019*dt*x1 + x2*x12 + 0.8960*dt*x2 + x5*x9 + dt*x5*x11 + 0.001*dt^2*x5 + x6*x10 + dt*x6*x12 + 0.4480*dt^2*x6 + 0.3828;
    f4 = x3*x11 + 0.0019*dt*x3 + x4*x12 + 0.8960*dt*x4 + x7*x9 + dt*x7*x11 + 0.001*dt^2*x7 + x8*x10 + dt*x8*x12 + 0.4480*dt^2*x8 - 0.3844;
    f5 = x1*x11 + 0.0080*dt*x1 + x2*x12 + 1.8396*dt*x2 + x5*x9 + 2*dt*x5*x11 + 0.0059*dt^2*x5 + x6*x10 + 2*dt*x6*x12 + 1.8158*dt^2*x6 + 0.8342;
    f6 = x3*x11 + 0.0080*dt*x3 + x4*x12 + 1.8396*dt*x4 + x7*x9 + 2*dt*x7*x11 + 0.0059*dt^2*x7 + x8*x10 + 2*dt*x8*x12 + 1.8158*dt^2*x8 - 0.8412;
    f7 = x1*x11 + 0.0189*dt*x1 + x2*x12 + 2.8060*dt*x2 + x5*x9 + 3*dt*x5*x11 + 0.0193*dt^2*x5 + x6*x10 + 3*dt*x6*x12 + 4.1386*dt^2*x6 + 1.3449;
    f8 = x3*x11 + 0.0189*dt*x3 + x4*x12 + 2.8060*dt*x4 + x7*x9 + 3*dt*x7*x11 + 0.0193*dt^2*x7 + x8*x10 + 3*dt*x8*x12 + 4.1386*dt^2*x8 - 1.3620;
    f9 = x1*x11 + 0.0351*dt*x1 + x2*x12 + 3.7696*dt*x2 + x5*x9 + 4*dt*x5*x11 + 0.0463*dt^2*x5 + x6*x10 + 4*dt*x6*x12 + 7.4264*dt^2*x6 + 1.9038;
    f10 = x3*x11 + 0.0351*dt*x3 + x4*x12 + 3.7696*dt*x4 + x7*x9 + 4*dt*x7*x11 + 0.0463*dt^2*x7 + x8*x10 + 4*dt*x8*x12 + 7.4264*dt^2*x8 - 1.9365;
    f11 = x1*x11 + 0.0571*dt*x1 + x2*x12 + 4.7050*dt*x2 + x5*x9 + 5*dt*x5*x11 + 0.0924*dt^2*x5 + x6*x10 + 5*dt*x6*x12 + 11.6637*dt^2*x6 + 2.4984;
    f12 = x3*x11 + 0.0571*dt*x3 + x4*x12 + 4.7050*dt*x4 + x7*x9 + 5*dt*x7*x11 + 0.0924*dt^2*x7 + x8*x10 + 5*dt*x8*x12 + 11.6637*dt^2*x8 - 2.5533;

    when using "solve" function in Matlab, no code is needed
    when using the Secant method, the code is as follows
    dt=1e-2;
    % initial values for variables
    varc=[120,-40,-40,40]; vark=[1600,-600,-600,600]; var=[];
    for i =1:25
    [var]=[var;[awgn(varc,20,'measured')],[awgn(vark,20,'measured')],[ 0.01*randn(1,4)], [0.1*randn(1,12)]];
    end
    k=12;tol=1e-6; ndof=2; ns=1; B=zeros(1,24); B=[B,1]'; neq=ns*k; % (neq is the number of equations)
    [A]=A2dofs(var,ndof,dt);
    [A]=[A;ones(1,k+1)];
    n=zeros(k+1,1); for ii=1:length(n) n(ii)=norm(A(1:neq,ii)); end
    xx=var; e1=max(n); % save result for visualization purpose
    for jj=1:500
    p=A\B;
    var_bar=p'*var;
    pp=[A2dofs(var_bar,ndof,dt);1];
    % Find the column which have maximal norm and replace:
    [maxn,Imax]=max(n);
    [minn,Imin]=min(n);
    var(Imax,=var_bar;
    A(:,Imax)=pp;
    n(Imax)=norm(pp(1:neq,1));
    err1=norm(var_bar-var(Imin,);
    err2=n(Imax); [e1]=[e1,max(err1,err2)];
    iter=jj;
    [xx]=[xx;var_bar];
    if (err1<tol) & (err2<tol)
    break
    end
    end

    Where A2dofs is simply the m-file to evaluate the value of the 12 functions at certain value of x1 to x12.
    If possible, pls contact me directly through my email: g0500479@nus.edu.sg
    Thank you very much.

    Now the appearance of dt in these equations suggests that what we are
    looking at is not simply a set of 12 non-linear simultaneous equations, but
    something like a step of a numerical integration scheme. If so it might be
    advantageous to step back and relook at the problem that gives rise to
    these equations.

    RonL
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. System of nonlinear equations
    Posted in the Advanced Algebra Forum
    Replies: 2
    Last Post: October 7th 2010, 06:19 AM
  2. System of nonlinear equations
    Posted in the Math Software Forum
    Replies: 2
    Last Post: June 11th 2010, 07:29 AM
  3. Confused about nonlinear system of equations
    Posted in the Algebra Forum
    Replies: 3
    Last Post: April 28th 2009, 10:20 PM
  4. nonlinear system of equations
    Posted in the Algebra Forum
    Replies: 1
    Last Post: April 28th 2009, 10:18 PM
  5. a nonlinear system of algebraic equations
    Posted in the Advanced Algebra Forum
    Replies: 0
    Last Post: March 18th 2009, 03:44 PM

Search Tags


/mathhelpforum @mathhelpforum