Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1035561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:33:42+00:00 2026-05-16T14:33:42+00:00

Firstly, this seems like (from ContourPlot) a fairly straightforward maximization problem, why is FindMaximum

  • 0

Firstly, this seems like (from ContourPlot) a fairly straightforward maximization problem, why is FindMaximum with Newton’s method having problems?

Secondly, how can I get rid of the warnings?

Thirdly, if I can’t get rid of these warnings, how can I tell if the warning is meaningful, ie, maximization failed?

For instance, in the code below, FindMaximum with Newton’s method gives a warning, whereas the PrincipalAxis method doesn’t

o = 1/5 Log[E^(-(h/Sqrt[3]))/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   3/10 Log[E^(h/Sqrt[3])/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   1/5 Log[E^(-(h/Sqrt[3]) - Sqrt[2] j)/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   1/10 Log[E^(h/Sqrt[3] - Sqrt[2] j)/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   1/10 Log[E^(-Sqrt[3] h + Sqrt[2] j)/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   1/10 Log[E^(Sqrt[3] h + Sqrt[2] j)/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))];
(* -1 makes more contours towards maximum *)

contourFunc[n_, p_] := Function[{min, max},
   range = max - min;
   Table[Exp[p (x - 1)] x range + min, {x, 0, 1, 1/n}]
   ];
cf = contourFunc[10, -1];
ContourPlot @@ {o, {j, -1, 1}, {h, -1, 1}, Contours -> cf}

FindMaximum @@ {o, {{j, 0}, {h, 0}}, Method -> "Newton"}
FindMaximum @@ {o, {{j, 0}, {h, 0}}, Method -> "PrincipalAxis"}

Note, I thought that maybe gradient being 0 in direction of one of the components was the problem, but if I perturb the initial point I still get the same warning, here’s an example

o = 1/5 Log[E^(-(h/Sqrt[3]))/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   1/5 Log[E^(h/Sqrt[3])/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   1/10 Log[E^(-(h/Sqrt[3]) - Sqrt[2] j)/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   3/10 Log[E^(h/Sqrt[3] - Sqrt[2] j)/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   1/10 Log[E^(-Sqrt[3] h + Sqrt[2] j)/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] + 
   1/10 Log[E^(Sqrt[3] h + Sqrt[2] j)/(
     2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) + 
      E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) + 
      E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))];
ContourPlot @@ {o, {j, -1, 1}, {h, -1, 1}}
FindMaximum @@ {o, {{j, -0.008983550852535105`}, {h, 
    0.06931364191023386`}}, Method -> "Newton"}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:33:42+00:00Added an answer on May 16, 2026 at 2:33 pm

    Mathematically, I’m not sure exactly why Netwon’s method fails, but the examples in the documentation for FindMaximum point out this specific problem and error message under Possible Issues: “With machine-precision arithmetic, even functions with smooth maxima may seem bumpy“.

    Thus, if you increase the working precision with e.g. the WorkingPrecision -> 20 option to FindMaximum the warnings go away:

    In[25]:= FindMaximum[o, {{j, 0}, {h, 0}}, Method->"Newton", WorkingPrecision->20]
    
    Out[25]= {-2.0694248079871222533, {j -> -0.14189560954670761863, h -> 0}}
    

    Given that the text of the error is fairly descriptive:

    FindMaximum::lstol: The line search decreased the step size to within the tolerance
    specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient increase
    in the function. You may need more than MachinePrecision digits of working precision to
    meet these tolerances. >>

    … I suspect Newton’s method is failing to reached a fixed point with sufficiently small error using machine-precision arithmetic.

    As the error message hints, you can instead use the AccuracyGoal option to specify the number of significant digits you want in the solution if you don’t want to switch to slower high-precision arithmetic:

    In[27]:= FindMaximum[o, {{j, 0}, {h, 0}}, Method -> "Newton", AccuracyGoal -> 5]
    
    Out[27]= {-2.06942, {j -> -0.141896, h -> -2.78113*10^-17}}
    

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the maven-clean-plugin with the initialize phase as given here… May 16, 2026 at 2:34 pm
  • Editorial Team
    Editorial Team added an answer Maybe it will help: Example html: <!DOCTYPE html PUBLIC "-//W3C//DTD… May 16, 2026 at 2:34 pm
  • Editorial Team
    Editorial Team added an answer I filter out certain source files by running the output… May 16, 2026 at 2:34 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Firstly, an apology for the length of this post. If brevity is the soul
Firstly, let me set out what I'd like to do. Assume I have three
I have a table in SQL Server which looks like this: ID Code Name
Firstly, this is not a question about repository synchronisation for which there are numerous
Firstly, is it possible? Been struggling with this one for hours; I think the
Firstly, I want to restrict this question to web development only. So this is
Currently, when I design my forms, I like to keep the name of the
Firstly, Real World Haskell , which I am reading, says to never use foldl
This is a two part question, but I want to make sure the first
Im attempting to add voteup/votedown to one of my sites, however Im having a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.