Mathematica Asked on March 8, 2021
I have a problem which I have not been able to solve. I want to plot a function and and operator which approximates it when you let w
to infinity. I will give all needed information for MWE and my faults.
$$
operatorname{Fejer}(x):= dfrac{1}{2} operatorname{sinc}^2left(dfrac{x}{2}right) quad (xin mathbb{R})
operatorname{sinc} x:=
begin{cases}
dfrac{sin pi x}{pi x}, & xin mathbb{R} backslash {0}
1, & x=0
end{cases}
operatorname{Function}(x):=begin{cases}
dfrac{9}{x^2},& x<3
2,& -3<x<-2
-dfrac{1}{2},& -2<x<-1
dfrac{3}{2}, & -1<x<0
1,& 0<x<1
-1,& 1<x<2
0,& 2<x<3
-dfrac{50}{x^4},& 3<x
end{cases}
$$
sinc[x_] := Piecewise[{{1, Equal[x, 0]}, {Sin[Pi x]/(Pi x), True}}]
Fejer[x_] := 1/2*sinc[x/2]^2
function[x_] :=
Piecewise[
{{9/(x^2), x < -3},
{2, -3 <= x < -2},
{-1/2, -2 <= x < -1},
{3/2, -1 <= x < 0},
{1, 0 <= x < 1},
{-1, 1 <= x < 2},
{0, 2 <= x < 3},
{-50/(x^4), 3 <= x}}]
constant[x_] := 1
With above code I am defining the functions which I gave mathematically above to make it easier for you. Now, I’m trying to define my operator.
operator[w_, kernel_, func_, x_] :=
Sum[
w *
Integrate[func[u], {u, k/w, (k + 1)/w}, Assumptions -> k ∈ Integers] *
kernel[w*x - k],
{k, -Infinity, Infinity}]
I’m not sure about the above code. I used Assumption
in the integral because I was getting errors like "integral limits may not reals, please add assumption". I also show it in MathJax so you can understand what I’m trying to do.
Operator
$$ (S_wf)(x):=sum_{kin mathbb{Z}} chi(wx-k) wint_{k/w}^{(k+1)/w} f(u)du , quad xin mathbb{R}, , w>0$$
When you take function to br $1$ for every $xin mathbb{R}$, operator gives $1$. Anyway when I running code
operator[w, Fejer, constant, x]
or
operator[5, Fejer, constant, x]
it gives nothing. When I tried plot
Plot[Operator[5, Fejer, cons, x], {x, 0, 5}]
it quits the kernel without an error.
When I tried
Plot[Operator[5, Fejer, function, x], {x, 0, 5}]
It gives many errors and some of them are:
NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.
NIntegrate::nlim: u = 0.2 k is not a valid limit of integration.
General::stop: Further output of NIntegrate::nlim will be suppressed during this calculation.
Finally, I’m adding a result which I’m trying to reach.
Clear["Global`*"]
$Version
(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)
The definition of Fejer
can be simplified to
Fejer[x_] := 1/2*Sinc[x Pi/2]^2
function[x_] :=
Piecewise[{{9/(x^2),
x < -3}, {2, -3 <= x < -2}, {-1/2, -2 <= x < -1}, {3/2, -1 <= x <
0}, {1, 0 <= x < 1}, {-1, 1 <= x < 2}, {0,
2 <= x < 3}, {-50/(x^4), 3 <= x}}]
Operator[w_, kernel_, func_, x_] :=
Sum[w*Integrate[func[u], {u, k/w, (k + 1)/w},
Assumptions -> k ∈ Integers]*
kernel[w*x - k], {k, -Infinity, Infinity}]
constant[x_] := 1
Operator[w, Fejer, constant, x] // FullSimplify
(* 1/4 (2 + (1/(π^2 w^2 x^2))
Cos[π w x] (-4 +
w^2 x^2 (4 PolyGamma[1, w x] + PolyGamma[1, 1/2 - (w x)/2] -
PolyGamma[1, 1 + (w x)/2])) + Sec[(π w x)/2]^2) *)
Evaluate
the function to be plotted
Plot[Operator[5, Fejer, constant, x] // FullSimplify // Evaluate,
{x, 0, 5}, WorkingPrecision -> 20, PlotRange -> {0, 1.1}]
This example is quite slow
Plot[Operator[5, Fejer, function, x] // N[#, 30] & // Evaluate,
{x, 0, 5}, WorkingPrecision -> 25]
EDIT: Higher precision is needed for negative values of x
Plot[Operator[5, Fejer, function, x] // N[#, 40] & //
Evaluate, {x, -5, 5}, WorkingPrecision -> 30]
Correct answer by Bob Hanlon on March 8, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP