Group Abstract Group Abstract

Message Boards Message Boards

FindMaximum::nrnum: The function value is not a real number

Posted 1 year ago
POSTED BY: Shafa Hananta
2 Replies
Posted 1 year ago

As Gianluca Gorni said, your function has complex number outputs. This is because your variable g is treated as an exponent in your function expression, which can cause complex output. Complex function is not optimizable. So you must need to convert it to real number.

Some suggestion: 1. use function such as Abs to convert your output to real number domain; 2. fix the variable g at integers and optimize the x only.

POSTED BY: Yifa Tian

Your function is complex-valued when g<0, as you can see from

Reduce[FunctionDomain[TP[x, g], {x, g}],
 {x, g}, Reals]

From a plot

Plot3D[TP[x, g], {x, 0, 1}, {g, 0, 10},
 PlotRange -> {-300, 0}]

I am tempted to guess that your function has no optimal point for x,g>0, or that the optimum is at x=Infinity, g=0. My suggestion is to give sensible constraints to x and g.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard