Approximate the sine function by a parabola
$begingroup$
I am looking at the following problem:
Approximate the sine function in the region of the first maximum in the positive $x-$area by a parabola.
Let $f(x)=sin(x)$.
The first maximum for $x>0$ is at $frac{pi}{2}$, isn't it?
How can we find by which parabola we have to approximate the sine function? Do we have to consider the Taylor expansion of $sin (x)$ at $x=frac{pi}{2}$?
But do we not get only odd powers of $x$?
calculus
$endgroup$
|
show 2 more comments
$begingroup$
I am looking at the following problem:
Approximate the sine function in the region of the first maximum in the positive $x-$area by a parabola.
Let $f(x)=sin(x)$.
The first maximum for $x>0$ is at $frac{pi}{2}$, isn't it?
How can we find by which parabola we have to approximate the sine function? Do we have to consider the Taylor expansion of $sin (x)$ at $x=frac{pi}{2}$?
But do we not get only odd powers of $x$?
calculus
$endgroup$
$begingroup$
You will get only even powers in the Taylor expansion of sine at $pi/2$ because it is in fact the expansion of cosine at 0.
$endgroup$
– user376343
Jan 12 at 10:23
$begingroup$
Do we have $$f(x)=fleft (frac{pi}{2}right )+f'left (frac{pi}{2}right )left (x-frac{pi}{2}right )+f''left (frac{pi}{2}right )frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:30
$begingroup$
So it is $$f(x)=1-frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:31
$begingroup$
Yes, that’s correct.
$endgroup$
– KM101
Jan 12 at 10:31
$begingroup$
What are the criteria for the approximation? Is it supposed to be "best" in some sense. You will get different answers depending on your definition of "best".
$endgroup$
– bubba
Jan 12 at 11:38
|
show 2 more comments
$begingroup$
I am looking at the following problem:
Approximate the sine function in the region of the first maximum in the positive $x-$area by a parabola.
Let $f(x)=sin(x)$.
The first maximum for $x>0$ is at $frac{pi}{2}$, isn't it?
How can we find by which parabola we have to approximate the sine function? Do we have to consider the Taylor expansion of $sin (x)$ at $x=frac{pi}{2}$?
But do we not get only odd powers of $x$?
calculus
$endgroup$
I am looking at the following problem:
Approximate the sine function in the region of the first maximum in the positive $x-$area by a parabola.
Let $f(x)=sin(x)$.
The first maximum for $x>0$ is at $frac{pi}{2}$, isn't it?
How can we find by which parabola we have to approximate the sine function? Do we have to consider the Taylor expansion of $sin (x)$ at $x=frac{pi}{2}$?
But do we not get only odd powers of $x$?
calculus
calculus
edited Jan 12 at 11:35
Exp ikx
1034
1034
asked Jan 12 at 10:05
Mary StarMary Star
3,02482268
3,02482268
$begingroup$
You will get only even powers in the Taylor expansion of sine at $pi/2$ because it is in fact the expansion of cosine at 0.
$endgroup$
– user376343
Jan 12 at 10:23
$begingroup$
Do we have $$f(x)=fleft (frac{pi}{2}right )+f'left (frac{pi}{2}right )left (x-frac{pi}{2}right )+f''left (frac{pi}{2}right )frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:30
$begingroup$
So it is $$f(x)=1-frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:31
$begingroup$
Yes, that’s correct.
$endgroup$
– KM101
Jan 12 at 10:31
$begingroup$
What are the criteria for the approximation? Is it supposed to be "best" in some sense. You will get different answers depending on your definition of "best".
$endgroup$
– bubba
Jan 12 at 11:38
|
show 2 more comments
$begingroup$
You will get only even powers in the Taylor expansion of sine at $pi/2$ because it is in fact the expansion of cosine at 0.
$endgroup$
– user376343
Jan 12 at 10:23
$begingroup$
Do we have $$f(x)=fleft (frac{pi}{2}right )+f'left (frac{pi}{2}right )left (x-frac{pi}{2}right )+f''left (frac{pi}{2}right )frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:30
$begingroup$
So it is $$f(x)=1-frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:31
$begingroup$
Yes, that’s correct.
$endgroup$
– KM101
Jan 12 at 10:31
$begingroup$
What are the criteria for the approximation? Is it supposed to be "best" in some sense. You will get different answers depending on your definition of "best".
$endgroup$
– bubba
Jan 12 at 11:38
$begingroup$
You will get only even powers in the Taylor expansion of sine at $pi/2$ because it is in fact the expansion of cosine at 0.
$endgroup$
– user376343
Jan 12 at 10:23
$begingroup$
You will get only even powers in the Taylor expansion of sine at $pi/2$ because it is in fact the expansion of cosine at 0.
$endgroup$
– user376343
Jan 12 at 10:23
$begingroup$
Do we have $$f(x)=fleft (frac{pi}{2}right )+f'left (frac{pi}{2}right )left (x-frac{pi}{2}right )+f''left (frac{pi}{2}right )frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:30
$begingroup$
Do we have $$f(x)=fleft (frac{pi}{2}right )+f'left (frac{pi}{2}right )left (x-frac{pi}{2}right )+f''left (frac{pi}{2}right )frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:30
$begingroup$
So it is $$f(x)=1-frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:31
$begingroup$
So it is $$f(x)=1-frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:31
$begingroup$
Yes, that’s correct.
$endgroup$
– KM101
Jan 12 at 10:31
$begingroup$
Yes, that’s correct.
$endgroup$
– KM101
Jan 12 at 10:31
$begingroup$
What are the criteria for the approximation? Is it supposed to be "best" in some sense. You will get different answers depending on your definition of "best".
$endgroup$
– bubba
Jan 12 at 11:38
$begingroup$
What are the criteria for the approximation? Is it supposed to be "best" in some sense. You will get different answers depending on your definition of "best".
$endgroup$
– bubba
Jan 12 at 11:38
|
show 2 more comments
2 Answers
2
active
oldest
votes
$begingroup$
You consider the Taylor Series centered at $a = frac{pi}{2}$. Using $sinleft(frac{pi}{2}right) = 1$, $sin’left(frac{pi}{2}right) = 0$ and $sin’’left(frac{pi}{2}right) = -1$, you get
$$f(x) approx 1-frac{1}{2!}left(x-frac{pi}{2}right)^2 = 1-frac{1}{2}left(x-frac{pi}{2}right)^2$$
As mentioned in the comments, it is also worth noting that this is equivalent to approximating cosine at $a = 0$, but shifted $frac{pi}{2}$ radians:
$$cos(x) approx 1-frac{1}{2}x^2; quad a = 0implies sin(x) approx 1-frac{1}{2}left(x-frac{pi}{2}right)^2; quad a = frac{pi}{2}$$
$endgroup$
add a comment |
$begingroup$
Just added for your curiosity.
As given to you, the question is slightly missing of context since, in particular, it not not precised for which range the approximation needs to be good.
If it is just around $x=frac pi 2$, then, as given in comments and answers, a Taylor expansion will be good.
Suppose now that you want the approximation to be good between $theta$ and $(pi-theta)$, $theta$ being given. Write the approximating function as
$$f(x)=a+b x+c x^2$$ and build the equation at three points
$$f(theta)=a+b theta +c theta ^2=sin(theta)tag 1$$
$$fleft(frac{pi }{2}right)=a+frac{pi b}{2}+frac{pi ^2 c}{4}=sinleft(frac{pi }{2}right)=1tag 2$$
$$f(pi-theta)=a+b (pi -theta )+c (pi -theta )^2=sin(theta)tag 3$$ Solving the system, you should get
$$a=frac{4 theta ^2-4 pi theta +pi ^2 sin (theta )}{(pi -2 theta )^2}qquad b=frac{4 pi (1-sin (theta ))}{(pi -2 theta )^2}qquad c=-frac{4 (1-sin (theta ))}{(pi -2 theta )^2}$$ If we take limits when $theta to frac pi 2$, this would give
$$a_{lim}=1-frac{pi ^2}{8}qquad b_{lim}=frac{pi }{2}qquad c_{lim}=-frac{1}{2}$$ which, effectively, corresponds to
$$f(x)=1-frac{1}{2}left(x-frac{pi}{2}right)^2$$ obtained by Taylor expansion.
But we could do better and consider that, as in a least-square fit, we want to minimize with respect to $(a,b,c)$
$$Phi(a,b,c)=int_theta^{pi-theta} left(a+b x+c x^2-sin (x)right)^2,dx$$ I shall skip the intermediate calculations and go to the results
$$a=frac{12 left(left(-4 left(theta ^2-5right) theta ^2+4 pi left(2 theta
^2-5right) theta -pi ^2 left(theta ^2+10right)-3 pi ^3 theta +pi
^4right) cos (theta )+5 left(4 theta ^3-6 pi theta ^2+pi ^3right) sin
(theta )right)}{(pi -2 theta )^5}$$
$$b=-frac{60 pi left(4 theta ^2 cos (theta )-12 theta sin (theta )+6 pi
sin (theta )-4 pi theta cos (theta )+pi ^2 cos (theta )-12 cos
(theta )right)}{(pi -2 theta )^5}$$
$$c=frac{60 left(6 (pi -2 theta ) sin (theta )+left((pi -2 theta )^2-12right)
cos (theta )right)}{(pi -2 theta )^5}$$
If we take limits when $theta to 0$, this would give
$$a_{lim}=-frac{12 left(10-pi ^2right)}{pi ^3}qquad b_{lim}=frac{60 left(12-pi ^2right)}{pi ^4}qquad c_{lim}=-frac{60 left(12-pi ^2right)}{pi ^5}$$ which will not reproduce the exact values of the since function at
$$theta=0 implies f(0)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$
$$theta=frac{pi }{2}implies fleft(frac{pi }{2}right)=frac{60-3 pi ^2}{pi ^3}approx 0.98016$$
$$theta=pi implies f(pi)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$ but which would be the best over the whole range.
The answer to an apparently simple question is not so simple; it depends very much on what you plan to do with the approximation.
$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: "69"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
},
noCode: 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%2fmath.stackexchange.com%2fquestions%2f3070753%2fapproximate-the-sine-function-by-a-parabola%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$
You consider the Taylor Series centered at $a = frac{pi}{2}$. Using $sinleft(frac{pi}{2}right) = 1$, $sin’left(frac{pi}{2}right) = 0$ and $sin’’left(frac{pi}{2}right) = -1$, you get
$$f(x) approx 1-frac{1}{2!}left(x-frac{pi}{2}right)^2 = 1-frac{1}{2}left(x-frac{pi}{2}right)^2$$
As mentioned in the comments, it is also worth noting that this is equivalent to approximating cosine at $a = 0$, but shifted $frac{pi}{2}$ radians:
$$cos(x) approx 1-frac{1}{2}x^2; quad a = 0implies sin(x) approx 1-frac{1}{2}left(x-frac{pi}{2}right)^2; quad a = frac{pi}{2}$$
$endgroup$
add a comment |
$begingroup$
You consider the Taylor Series centered at $a = frac{pi}{2}$. Using $sinleft(frac{pi}{2}right) = 1$, $sin’left(frac{pi}{2}right) = 0$ and $sin’’left(frac{pi}{2}right) = -1$, you get
$$f(x) approx 1-frac{1}{2!}left(x-frac{pi}{2}right)^2 = 1-frac{1}{2}left(x-frac{pi}{2}right)^2$$
As mentioned in the comments, it is also worth noting that this is equivalent to approximating cosine at $a = 0$, but shifted $frac{pi}{2}$ radians:
$$cos(x) approx 1-frac{1}{2}x^2; quad a = 0implies sin(x) approx 1-frac{1}{2}left(x-frac{pi}{2}right)^2; quad a = frac{pi}{2}$$
$endgroup$
add a comment |
$begingroup$
You consider the Taylor Series centered at $a = frac{pi}{2}$. Using $sinleft(frac{pi}{2}right) = 1$, $sin’left(frac{pi}{2}right) = 0$ and $sin’’left(frac{pi}{2}right) = -1$, you get
$$f(x) approx 1-frac{1}{2!}left(x-frac{pi}{2}right)^2 = 1-frac{1}{2}left(x-frac{pi}{2}right)^2$$
As mentioned in the comments, it is also worth noting that this is equivalent to approximating cosine at $a = 0$, but shifted $frac{pi}{2}$ radians:
$$cos(x) approx 1-frac{1}{2}x^2; quad a = 0implies sin(x) approx 1-frac{1}{2}left(x-frac{pi}{2}right)^2; quad a = frac{pi}{2}$$
$endgroup$
You consider the Taylor Series centered at $a = frac{pi}{2}$. Using $sinleft(frac{pi}{2}right) = 1$, $sin’left(frac{pi}{2}right) = 0$ and $sin’’left(frac{pi}{2}right) = -1$, you get
$$f(x) approx 1-frac{1}{2!}left(x-frac{pi}{2}right)^2 = 1-frac{1}{2}left(x-frac{pi}{2}right)^2$$
As mentioned in the comments, it is also worth noting that this is equivalent to approximating cosine at $a = 0$, but shifted $frac{pi}{2}$ radians:
$$cos(x) approx 1-frac{1}{2}x^2; quad a = 0implies sin(x) approx 1-frac{1}{2}left(x-frac{pi}{2}right)^2; quad a = frac{pi}{2}$$
answered Jan 12 at 10:31
KM101KM101
5,9281524
5,9281524
add a comment |
add a comment |
$begingroup$
Just added for your curiosity.
As given to you, the question is slightly missing of context since, in particular, it not not precised for which range the approximation needs to be good.
If it is just around $x=frac pi 2$, then, as given in comments and answers, a Taylor expansion will be good.
Suppose now that you want the approximation to be good between $theta$ and $(pi-theta)$, $theta$ being given. Write the approximating function as
$$f(x)=a+b x+c x^2$$ and build the equation at three points
$$f(theta)=a+b theta +c theta ^2=sin(theta)tag 1$$
$$fleft(frac{pi }{2}right)=a+frac{pi b}{2}+frac{pi ^2 c}{4}=sinleft(frac{pi }{2}right)=1tag 2$$
$$f(pi-theta)=a+b (pi -theta )+c (pi -theta )^2=sin(theta)tag 3$$ Solving the system, you should get
$$a=frac{4 theta ^2-4 pi theta +pi ^2 sin (theta )}{(pi -2 theta )^2}qquad b=frac{4 pi (1-sin (theta ))}{(pi -2 theta )^2}qquad c=-frac{4 (1-sin (theta ))}{(pi -2 theta )^2}$$ If we take limits when $theta to frac pi 2$, this would give
$$a_{lim}=1-frac{pi ^2}{8}qquad b_{lim}=frac{pi }{2}qquad c_{lim}=-frac{1}{2}$$ which, effectively, corresponds to
$$f(x)=1-frac{1}{2}left(x-frac{pi}{2}right)^2$$ obtained by Taylor expansion.
But we could do better and consider that, as in a least-square fit, we want to minimize with respect to $(a,b,c)$
$$Phi(a,b,c)=int_theta^{pi-theta} left(a+b x+c x^2-sin (x)right)^2,dx$$ I shall skip the intermediate calculations and go to the results
$$a=frac{12 left(left(-4 left(theta ^2-5right) theta ^2+4 pi left(2 theta
^2-5right) theta -pi ^2 left(theta ^2+10right)-3 pi ^3 theta +pi
^4right) cos (theta )+5 left(4 theta ^3-6 pi theta ^2+pi ^3right) sin
(theta )right)}{(pi -2 theta )^5}$$
$$b=-frac{60 pi left(4 theta ^2 cos (theta )-12 theta sin (theta )+6 pi
sin (theta )-4 pi theta cos (theta )+pi ^2 cos (theta )-12 cos
(theta )right)}{(pi -2 theta )^5}$$
$$c=frac{60 left(6 (pi -2 theta ) sin (theta )+left((pi -2 theta )^2-12right)
cos (theta )right)}{(pi -2 theta )^5}$$
If we take limits when $theta to 0$, this would give
$$a_{lim}=-frac{12 left(10-pi ^2right)}{pi ^3}qquad b_{lim}=frac{60 left(12-pi ^2right)}{pi ^4}qquad c_{lim}=-frac{60 left(12-pi ^2right)}{pi ^5}$$ which will not reproduce the exact values of the since function at
$$theta=0 implies f(0)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$
$$theta=frac{pi }{2}implies fleft(frac{pi }{2}right)=frac{60-3 pi ^2}{pi ^3}approx 0.98016$$
$$theta=pi implies f(pi)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$ but which would be the best over the whole range.
The answer to an apparently simple question is not so simple; it depends very much on what you plan to do with the approximation.
$endgroup$
add a comment |
$begingroup$
Just added for your curiosity.
As given to you, the question is slightly missing of context since, in particular, it not not precised for which range the approximation needs to be good.
If it is just around $x=frac pi 2$, then, as given in comments and answers, a Taylor expansion will be good.
Suppose now that you want the approximation to be good between $theta$ and $(pi-theta)$, $theta$ being given. Write the approximating function as
$$f(x)=a+b x+c x^2$$ and build the equation at three points
$$f(theta)=a+b theta +c theta ^2=sin(theta)tag 1$$
$$fleft(frac{pi }{2}right)=a+frac{pi b}{2}+frac{pi ^2 c}{4}=sinleft(frac{pi }{2}right)=1tag 2$$
$$f(pi-theta)=a+b (pi -theta )+c (pi -theta )^2=sin(theta)tag 3$$ Solving the system, you should get
$$a=frac{4 theta ^2-4 pi theta +pi ^2 sin (theta )}{(pi -2 theta )^2}qquad b=frac{4 pi (1-sin (theta ))}{(pi -2 theta )^2}qquad c=-frac{4 (1-sin (theta ))}{(pi -2 theta )^2}$$ If we take limits when $theta to frac pi 2$, this would give
$$a_{lim}=1-frac{pi ^2}{8}qquad b_{lim}=frac{pi }{2}qquad c_{lim}=-frac{1}{2}$$ which, effectively, corresponds to
$$f(x)=1-frac{1}{2}left(x-frac{pi}{2}right)^2$$ obtained by Taylor expansion.
But we could do better and consider that, as in a least-square fit, we want to minimize with respect to $(a,b,c)$
$$Phi(a,b,c)=int_theta^{pi-theta} left(a+b x+c x^2-sin (x)right)^2,dx$$ I shall skip the intermediate calculations and go to the results
$$a=frac{12 left(left(-4 left(theta ^2-5right) theta ^2+4 pi left(2 theta
^2-5right) theta -pi ^2 left(theta ^2+10right)-3 pi ^3 theta +pi
^4right) cos (theta )+5 left(4 theta ^3-6 pi theta ^2+pi ^3right) sin
(theta )right)}{(pi -2 theta )^5}$$
$$b=-frac{60 pi left(4 theta ^2 cos (theta )-12 theta sin (theta )+6 pi
sin (theta )-4 pi theta cos (theta )+pi ^2 cos (theta )-12 cos
(theta )right)}{(pi -2 theta )^5}$$
$$c=frac{60 left(6 (pi -2 theta ) sin (theta )+left((pi -2 theta )^2-12right)
cos (theta )right)}{(pi -2 theta )^5}$$
If we take limits when $theta to 0$, this would give
$$a_{lim}=-frac{12 left(10-pi ^2right)}{pi ^3}qquad b_{lim}=frac{60 left(12-pi ^2right)}{pi ^4}qquad c_{lim}=-frac{60 left(12-pi ^2right)}{pi ^5}$$ which will not reproduce the exact values of the since function at
$$theta=0 implies f(0)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$
$$theta=frac{pi }{2}implies fleft(frac{pi }{2}right)=frac{60-3 pi ^2}{pi ^3}approx 0.98016$$
$$theta=pi implies f(pi)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$ but which would be the best over the whole range.
The answer to an apparently simple question is not so simple; it depends very much on what you plan to do with the approximation.
$endgroup$
add a comment |
$begingroup$
Just added for your curiosity.
As given to you, the question is slightly missing of context since, in particular, it not not precised for which range the approximation needs to be good.
If it is just around $x=frac pi 2$, then, as given in comments and answers, a Taylor expansion will be good.
Suppose now that you want the approximation to be good between $theta$ and $(pi-theta)$, $theta$ being given. Write the approximating function as
$$f(x)=a+b x+c x^2$$ and build the equation at three points
$$f(theta)=a+b theta +c theta ^2=sin(theta)tag 1$$
$$fleft(frac{pi }{2}right)=a+frac{pi b}{2}+frac{pi ^2 c}{4}=sinleft(frac{pi }{2}right)=1tag 2$$
$$f(pi-theta)=a+b (pi -theta )+c (pi -theta )^2=sin(theta)tag 3$$ Solving the system, you should get
$$a=frac{4 theta ^2-4 pi theta +pi ^2 sin (theta )}{(pi -2 theta )^2}qquad b=frac{4 pi (1-sin (theta ))}{(pi -2 theta )^2}qquad c=-frac{4 (1-sin (theta ))}{(pi -2 theta )^2}$$ If we take limits when $theta to frac pi 2$, this would give
$$a_{lim}=1-frac{pi ^2}{8}qquad b_{lim}=frac{pi }{2}qquad c_{lim}=-frac{1}{2}$$ which, effectively, corresponds to
$$f(x)=1-frac{1}{2}left(x-frac{pi}{2}right)^2$$ obtained by Taylor expansion.
But we could do better and consider that, as in a least-square fit, we want to minimize with respect to $(a,b,c)$
$$Phi(a,b,c)=int_theta^{pi-theta} left(a+b x+c x^2-sin (x)right)^2,dx$$ I shall skip the intermediate calculations and go to the results
$$a=frac{12 left(left(-4 left(theta ^2-5right) theta ^2+4 pi left(2 theta
^2-5right) theta -pi ^2 left(theta ^2+10right)-3 pi ^3 theta +pi
^4right) cos (theta )+5 left(4 theta ^3-6 pi theta ^2+pi ^3right) sin
(theta )right)}{(pi -2 theta )^5}$$
$$b=-frac{60 pi left(4 theta ^2 cos (theta )-12 theta sin (theta )+6 pi
sin (theta )-4 pi theta cos (theta )+pi ^2 cos (theta )-12 cos
(theta )right)}{(pi -2 theta )^5}$$
$$c=frac{60 left(6 (pi -2 theta ) sin (theta )+left((pi -2 theta )^2-12right)
cos (theta )right)}{(pi -2 theta )^5}$$
If we take limits when $theta to 0$, this would give
$$a_{lim}=-frac{12 left(10-pi ^2right)}{pi ^3}qquad b_{lim}=frac{60 left(12-pi ^2right)}{pi ^4}qquad c_{lim}=-frac{60 left(12-pi ^2right)}{pi ^5}$$ which will not reproduce the exact values of the since function at
$$theta=0 implies f(0)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$
$$theta=frac{pi }{2}implies fleft(frac{pi }{2}right)=frac{60-3 pi ^2}{pi ^3}approx 0.98016$$
$$theta=pi implies f(pi)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$ but which would be the best over the whole range.
The answer to an apparently simple question is not so simple; it depends very much on what you plan to do with the approximation.
$endgroup$
Just added for your curiosity.
As given to you, the question is slightly missing of context since, in particular, it not not precised for which range the approximation needs to be good.
If it is just around $x=frac pi 2$, then, as given in comments and answers, a Taylor expansion will be good.
Suppose now that you want the approximation to be good between $theta$ and $(pi-theta)$, $theta$ being given. Write the approximating function as
$$f(x)=a+b x+c x^2$$ and build the equation at three points
$$f(theta)=a+b theta +c theta ^2=sin(theta)tag 1$$
$$fleft(frac{pi }{2}right)=a+frac{pi b}{2}+frac{pi ^2 c}{4}=sinleft(frac{pi }{2}right)=1tag 2$$
$$f(pi-theta)=a+b (pi -theta )+c (pi -theta )^2=sin(theta)tag 3$$ Solving the system, you should get
$$a=frac{4 theta ^2-4 pi theta +pi ^2 sin (theta )}{(pi -2 theta )^2}qquad b=frac{4 pi (1-sin (theta ))}{(pi -2 theta )^2}qquad c=-frac{4 (1-sin (theta ))}{(pi -2 theta )^2}$$ If we take limits when $theta to frac pi 2$, this would give
$$a_{lim}=1-frac{pi ^2}{8}qquad b_{lim}=frac{pi }{2}qquad c_{lim}=-frac{1}{2}$$ which, effectively, corresponds to
$$f(x)=1-frac{1}{2}left(x-frac{pi}{2}right)^2$$ obtained by Taylor expansion.
But we could do better and consider that, as in a least-square fit, we want to minimize with respect to $(a,b,c)$
$$Phi(a,b,c)=int_theta^{pi-theta} left(a+b x+c x^2-sin (x)right)^2,dx$$ I shall skip the intermediate calculations and go to the results
$$a=frac{12 left(left(-4 left(theta ^2-5right) theta ^2+4 pi left(2 theta
^2-5right) theta -pi ^2 left(theta ^2+10right)-3 pi ^3 theta +pi
^4right) cos (theta )+5 left(4 theta ^3-6 pi theta ^2+pi ^3right) sin
(theta )right)}{(pi -2 theta )^5}$$
$$b=-frac{60 pi left(4 theta ^2 cos (theta )-12 theta sin (theta )+6 pi
sin (theta )-4 pi theta cos (theta )+pi ^2 cos (theta )-12 cos
(theta )right)}{(pi -2 theta )^5}$$
$$c=frac{60 left(6 (pi -2 theta ) sin (theta )+left((pi -2 theta )^2-12right)
cos (theta )right)}{(pi -2 theta )^5}$$
If we take limits when $theta to 0$, this would give
$$a_{lim}=-frac{12 left(10-pi ^2right)}{pi ^3}qquad b_{lim}=frac{60 left(12-pi ^2right)}{pi ^4}qquad c_{lim}=-frac{60 left(12-pi ^2right)}{pi ^5}$$ which will not reproduce the exact values of the since function at
$$theta=0 implies f(0)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$
$$theta=frac{pi }{2}implies fleft(frac{pi }{2}right)=frac{60-3 pi ^2}{pi ^3}approx 0.98016$$
$$theta=pi implies f(pi)=-frac{12 left(10-pi ^2right)}{pi ^3}approx -0.05047$$ but which would be the best over the whole range.
The answer to an apparently simple question is not so simple; it depends very much on what you plan to do with the approximation.
answered Jan 12 at 15:10
Claude LeiboviciClaude Leibovici
120k1157132
120k1157132
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics 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%2fmath.stackexchange.com%2fquestions%2f3070753%2fapproximate-the-sine-function-by-a-parabola%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
$begingroup$
You will get only even powers in the Taylor expansion of sine at $pi/2$ because it is in fact the expansion of cosine at 0.
$endgroup$
– user376343
Jan 12 at 10:23
$begingroup$
Do we have $$f(x)=fleft (frac{pi}{2}right )+f'left (frac{pi}{2}right )left (x-frac{pi}{2}right )+f''left (frac{pi}{2}right )frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:30
$begingroup$
So it is $$f(x)=1-frac{left (x-frac{pi}{2}right )^2}{2}$$ or not? @user376343
$endgroup$
– Mary Star
Jan 12 at 10:31
$begingroup$
Yes, that’s correct.
$endgroup$
– KM101
Jan 12 at 10:31
$begingroup$
What are the criteria for the approximation? Is it supposed to be "best" in some sense. You will get different answers depending on your definition of "best".
$endgroup$
– bubba
Jan 12 at 11:38