Menu

fsolve as a sub-function

Help
2016-06-15
2016-06-16
  • Christoph Alert

    Christoph Alert - 2016-06-15

    Hi,
    I want to create the jacbobian from a function and therefore using Adigator. My function contains fsolve which causes some problems. I tried a simple example but it is not working. Example
    Para = adigatorCreateDerivInput([2, 1],'Para'); genout = adigatorGenJacFile('loeser',{Para});
    The function loeser looks like:

    function Res =loeser(Parameter)
    X0= [-1;1];
    Par = Parameter;
    fun = @(x_it)[x_it(1)+Par(1),Par(2)*x_it(1)+x_it(2)^2];
    Res = fsolve(fun,X0);
    end
    

    Then I recieve the error:
    Error using fsolve (line 160)
    FSOLVE requires the following inputs to be of data type double: 'X0'.

    Error in adigatortempfunc1 (line 11)
    Res = fsolve(fun,X0);

    Error in adigator (line 505)
    FunctionInfo = adigatortempfunc1(FunctionInfo,UserFunInputs);

    Error in adigatorGenJacFile (line 128)
    [adiout,FunctionInfo] =
    adigator(UserFunName,UserFunInputs,AdiJacFileName,opts);

    Error in main_9 (line 14)
    genout = adigatorGenJacFile('loeser',{Para});

    adigatortempfunc1 calls again fsolve but changes the type of X0. Any idea to solve this?

    Thanks Christoph

     
    • Anil V. Rao

      Anil V. Rao - 2016-06-15

      Christoph

      ADiGator requires that all functions be in the overloaded library. The
      function fsolve in MATLAB is not overloaded by ADiGator, nor could it be
      because ADiGator differentiates user source code. You are asking to take
      the derivative of a function (loeser) which depends upon a function that is
      neither in the ADiGator overloaded library not could be written to be in
      the overloaded library due to the nature of fsolve itself.

      Anil

      On Wed, Jun 15, 2016 at 8:38 AM, Christoph Alert <christoph2222@users.sf.net

      wrote:

      Hi,
      I want to create the jacbobian from a function and therefore using
      Adigator. My function contains fsolve which causes some problems. I tried a
      simple example but it is not working. Example
      Para = adigatorCreateDerivInput([2, 1],'Para'); genout =
      adigatorGenJacFile('loeser',{Para});
      The function loeser looks like:

      function Res =loeser(Parameter)X0= [-1;1];Par = Parameter;fun = @(x_it)[x_it(1)+Par(1),Par(2)*x_it(1)+x_it(2)^2];Res = fsolve(fun,X0);end

      Then I recieve the error:
      Error using fsolve (line 160)
      FSOLVE requires the following inputs to be of data type double: 'X0'.

      Error in adigatortempfunc1 (line 11)
      Res = fsolve(fun,X0);

      Error in adigator (line 505)
      FunctionInfo = adigatortempfunc1(FunctionInfo,UserFunInputs);

      Error in adigatorGenJacFile (line 128)
      [adiout,FunctionInfo] =
      adigator(UserFunName,UserFunInputs,AdiJacFileName,opts);

      Error in main_9 (line 14)
      genout = adigatorGenJacFile('loeser',{Para});

      adigatortempfunc1 calls again fsolve but changes the type of X0. Any idea
      to solve this?

      Thanks Christoph

      fsolve as a sub-function
      https://sourceforge.net/p/adigator/discussion/help/thread/022ec325/?limit=25#e302


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/adigator/discussion/help/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      Anil V. Rao, PhD
      Tel: (352) 672-1529
      E-mail: anilvrao@gmail.com
      Website: http://www.anilvrao.com

       
      • Christoph Alert

        Christoph Alert - 2016-06-16

        Thank you Anil for your reply.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.