Maximum point of a rational function
$begingroup$
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.
evaluation polynomials
$endgroup$
add a comment |
$begingroup$
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.
evaluation polynomials
$endgroup$
1
$begingroup$
triedFindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
?
$endgroup$
– kglr
Jan 21 at 12:31
$begingroup$
The issue is thatpol[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:31
$begingroup$
@kglr thanks now it works.
$endgroup$
– William
Jan 21 at 12:35
$begingroup$
Trypol=Simplify[pol]
before using it.
$endgroup$
– Somos
Jan 21 at 20:43
add a comment |
$begingroup$
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.
evaluation polynomials
$endgroup$
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.
evaluation polynomials
evaluation polynomials
asked Jan 21 at 12:24
WilliamWilliam
80458
80458
1
$begingroup$
triedFindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
?
$endgroup$
– kglr
Jan 21 at 12:31
$begingroup$
The issue is thatpol[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:31
$begingroup$
@kglr thanks now it works.
$endgroup$
– William
Jan 21 at 12:35
$begingroup$
Trypol=Simplify[pol]
before using it.
$endgroup$
– Somos
Jan 21 at 20:43
add a comment |
1
$begingroup$
triedFindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
?
$endgroup$
– kglr
Jan 21 at 12:31
$begingroup$
The issue is thatpol[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:31
$begingroup$
@kglr thanks now it works.
$endgroup$
– William
Jan 21 at 12:35
$begingroup$
Trypol=Simplify[pol]
before using it.
$endgroup$
– Somos
Jan 21 at 20:43
1
1
$begingroup$
tried
FindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
?$endgroup$
– kglr
Jan 21 at 12:31
$begingroup$
tried
FindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
?$endgroup$
– kglr
Jan 21 at 12:31
$begingroup$
The issue is that
pol[0]
is undefined as it evaluates to 0/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 at x=0
. Thus most likely the algorithm fails.$endgroup$
– gothicVI
Jan 21 at 12:31
$begingroup$
The issue is that
pol[0]
is undefined as it evaluates to 0/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 at x=0
. Thus most likely the algorithm fails.$endgroup$
– gothicVI
Jan 21 at 12:31
$begingroup$
@kglr thanks now it works.
$endgroup$
– William
Jan 21 at 12:35
$begingroup$
@kglr thanks now it works.
$endgroup$
– William
Jan 21 at 12:35
$begingroup$
Try
pol=Simplify[pol]
before using it.$endgroup$
– Somos
Jan 21 at 20:43
$begingroup$
Try
pol=Simplify[pol]
before using it.$endgroup$
– Somos
Jan 21 at 20:43
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
FindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
1.0002
FindMaxValue >> Details and Options
:
- FindMaxValue[$f$,{$x$,$x_0$,$x_1$}] searches for a local maximum in $f$ using $x_0$ and $x_1$ as the first two values of $x$, avoiding the use of derivatives.
That is, {x, 0, 1}
in in FindMaxValue[pol, {x, 0, 1}]
does not represent a constraint; you need to specify the constraints in the first argument.
$endgroup$
add a comment |
$begingroup$
This might be a bit more stable in some cases:
f = Log[Numerator[pol]] - Log[Denominator[pol]];
Exp@FindMaxValue[{f, 0 <= x <= 1}, {x, .5}]
1.0002
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f189934%2fmaximum-point-of-a-rational-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
FindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
1.0002
FindMaxValue >> Details and Options
:
- FindMaxValue[$f$,{$x$,$x_0$,$x_1$}] searches for a local maximum in $f$ using $x_0$ and $x_1$ as the first two values of $x$, avoiding the use of derivatives.
That is, {x, 0, 1}
in in FindMaxValue[pol, {x, 0, 1}]
does not represent a constraint; you need to specify the constraints in the first argument.
$endgroup$
add a comment |
$begingroup$
FindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
1.0002
FindMaxValue >> Details and Options
:
- FindMaxValue[$f$,{$x$,$x_0$,$x_1$}] searches for a local maximum in $f$ using $x_0$ and $x_1$ as the first two values of $x$, avoiding the use of derivatives.
That is, {x, 0, 1}
in in FindMaxValue[pol, {x, 0, 1}]
does not represent a constraint; you need to specify the constraints in the first argument.
$endgroup$
add a comment |
$begingroup$
FindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
1.0002
FindMaxValue >> Details and Options
:
- FindMaxValue[$f$,{$x$,$x_0$,$x_1$}] searches for a local maximum in $f$ using $x_0$ and $x_1$ as the first two values of $x$, avoiding the use of derivatives.
That is, {x, 0, 1}
in in FindMaxValue[pol, {x, 0, 1}]
does not represent a constraint; you need to specify the constraints in the first argument.
$endgroup$
FindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
1.0002
FindMaxValue >> Details and Options
:
- FindMaxValue[$f$,{$x$,$x_0$,$x_1$}] searches for a local maximum in $f$ using $x_0$ and $x_1$ as the first two values of $x$, avoiding the use of derivatives.
That is, {x, 0, 1}
in in FindMaxValue[pol, {x, 0, 1}]
does not represent a constraint; you need to specify the constraints in the first argument.
edited Jan 21 at 12:49
answered Jan 21 at 12:39
kglrkglr
185k10202421
185k10202421
add a comment |
add a comment |
$begingroup$
This might be a bit more stable in some cases:
f = Log[Numerator[pol]] - Log[Denominator[pol]];
Exp@FindMaxValue[{f, 0 <= x <= 1}, {x, .5}]
1.0002
$endgroup$
add a comment |
$begingroup$
This might be a bit more stable in some cases:
f = Log[Numerator[pol]] - Log[Denominator[pol]];
Exp@FindMaxValue[{f, 0 <= x <= 1}, {x, .5}]
1.0002
$endgroup$
add a comment |
$begingroup$
This might be a bit more stable in some cases:
f = Log[Numerator[pol]] - Log[Denominator[pol]];
Exp@FindMaxValue[{f, 0 <= x <= 1}, {x, .5}]
1.0002
$endgroup$
This might be a bit more stable in some cases:
f = Log[Numerator[pol]] - Log[Denominator[pol]];
Exp@FindMaxValue[{f, 0 <= x <= 1}, {x, .5}]
1.0002
answered Jan 21 at 12:50
Henrik SchumacherHenrik Schumacher
54.6k474153
54.6k474153
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f189934%2fmaximum-point-of-a-rational-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
$begingroup$
tried
FindMaxValue[{pol, 0 <= x <= 1}, {x, .5}]
?$endgroup$
– kglr
Jan 21 at 12:31
$begingroup$
The issue is that
pol[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:31
$begingroup$
@kglr thanks now it works.
$endgroup$
– William
Jan 21 at 12:35
$begingroup$
Try
pol=Simplify[pol]
before using it.$endgroup$
– Somos
Jan 21 at 20:43