Suppose I have the following rational function:
pol=(354.071 x + 1136.03 x^2 + 2301.83 x^3 + 3771.25 x^4 + 5371.14 x^5 +
6303.09 x^6 + 6706.8 x^7 + 6518.86 x^8 + 5439.16 x^9 +
4614.45 x^10 + 3459.79 x^11 + 2655.16 x^12 + 2101.17 x^13 +
1522.11 x^14 + 1076.82 x^15 + 756.594 x^16 + 480.121 x^17 +
262.326 x^18 + 204.555 x^19 + 111.024 x^20 + 56.7865 x^21 +
27.375 x^22 + 28.2448 x^23 + 19.7196 x^24 + 5.61942 x^25 +
3.73647 x^26 + 0.931673 x^27 + 1.85847 x^28 + 2.7804 x^29 +
0.924375 x^30 + 1.84391 x^31)/(354 x + 1143 x^2 + 2320 x^3 +
3811 x^4 + 5441 x^5 + 6403 x^6 + 6829 x^7 + 6658 x^8 + 5571 x^9 +
4737 x^10 + 3560 x^11 + 2741 x^12 + 2174 x^13 + 1579 x^14 +
1120 x^15 + 789 x^16 + 502 x^17 + 275 x^18 + 215 x^19 + 117 x^20 +
59 x^21 + 30 x^22 + 30 x^23 + 21 x^24 + 6 x^25 + 4 x^26 + x^27 +
2 x^28 + 3 x^29 + x^30 + 2 x^31)
I am interested in this function between 0 and 1, so I plot it as:
Plot[pol, {x, 0, 1}, PlotRange -> All]
which gives:
Now I want to find the maximum value of this plot, it can be seen roughly that the point exists roughly above 1. To find it I do:
FindMaxValue[pol, {x, 0, 1}]
which thrown error as valuation from exact 0 gives 1/0 in the fraction, so I reduce the precision from
FindMaxValue[pol, {x, 10^-3, 1}]
which gives:
67857.7
which is plain wrong. I wonder how one solves this issue? and how one can evaluate the function between 0 and 1 rather that 10^-3.
FindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
? $\endgroup$ – kglr Jan 21 at 12:31pol[0]
is undefined as it evaluates to0/0
. The classical method to find the maximal value is to determine the first and eventually the second derivative. However, both of these do not exist atx=0
. Thus most likely the algorithm fails. $\endgroup$ – gothicVI Jan 21 at 12:31pol=Simplify[pol]
before using it. $\endgroup$ – Somos Jan 21 at 20:43