Message Boards Message Boards

0
|
7912 Views
|
8 Replies
|
2 Total Likes
View groups...
Share
Share this post:

NMaximize gives wrong result

Posted 10 years ago

Hi, i am experiencing this issue with NMaximize function. The function returns a maximum value 0.999985, but in graph shows that the maximum is 0.999706. Does anyone knows why is this happening?

Availability

POSTED BY: Thanasis Mnt
8 Replies
Posted 10 years ago

Hi again, i solved my problem including Method -> "NelderMead" to my NMaximize function and the result is rigth now.

POSTED BY: Thanasis Mnt

Sorry, I was unclear. Run Availability on the actual value returned by NMaximize.

Mathematica clips numbers when displaying them. This is so that the output stays readable. For example:

N[Pi]
3.14159

InputForm@%
3.141592653589793

InputForm shows you the actual output of a command. Try using it to see what the rest of the decimal values are in (5193.6.....)

InputForm[NMaximize[Availability[...],....]]

Is the value for Availability different when these digits are used?

I'm guessing that this difference in value is a numerical instability in the definition of Availability. Are you expecting availability to be smooth or jagged?

POSTED BY: Sean Clarke
Posted 10 years ago

NMaximize returns 0.999985 for T1 = 5193.6 Availability[5193.6] returns 0.999706 I am running now Table[Availability[T1], {T1, 8760}] to see which value is maximum

POSTED BY: Thanasis Mnt

What is the value of Availability at the point (5193.6.....) found by NMaximize? Is it the value shown by NMaximize? I'd would bet the point returned by NMaximize actually exists.

The plot might not be sampled at enough intervals to show the true maximum if the function has some erratic behavior. I'd bet your problem is with Plot and not NMaximize.

Plots are good tools for intuition, but they often are really deceiving.

POSTED BY: Sean Clarke

A notebook file with all the code and information to needed to duplicate the result would be the straight-forward method.

Please include

$Version

and its output.

POSTED BY: Bruce Miller
Posted 10 years ago

Sorry, I should have been more specific. Given the form of your function, the complete definition is necessary. What are all of the v, h, and sumsp functions?

POSTED BY: Jim Baldwin
Posted 10 years ago
Availability[T1_] = (v0[T1]*h0[T1] + v1[T1]*h1[T1] + v2[T1]*h2[T1] + v3[T1]*h3[T1] + v9[T1]*h9[T1] + v10[T1]*h10[T1] + v11[T1]*h11[T1] + v12[T1]*h12[T1] + v19[T1]*h19[T1] + v20[T1]*h20[T1] + v21[T1]*h21[T1] + v22[T1]*h22[T1] + v23[T1]*h23[T1] + v29[T1]*h29[T1] + v30[T1]*h30[T1] + v31[T1]*h31[T1])/sumssp[T1];
POSTED BY: Thanasis Mnt
Posted 10 years ago

Prior to sending in a bug report I would think that providing the definition of your function Availability would need to be supplied. Would you share the definition of that function?

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

Group Abstract Group Abstract