Skip to main content
Notice removed Draw attention by CrimsonDark
Bounty Ended with Alex Trounev's answer chosen by CrimsonDark
added 63 characters in body
Source Link
CrimsonDark
  • 421
  • 2
  • 12

I would like to be able to evaluate, numerically, the function $f(n, a, w)$ shown below so that I can:

  • integrate $f(n, a, w)$ over the range $[0 \le p \le 1]$ for various positive integer $n < 50$ real $0 < a < 5$ (I'm particularly interested in the range $1/50 < a < 3/2$ );

  • graphically explore the relationship between the value of the integral and $w$ for the those same values of $n$ and $a$;

  • estimate, within about $0.005$, the value of $w$ that minimizes the integral for the same $n$ and $a$.

I have more experience with Mathematica's symbolic capabilities than with the numerical side . Given the oscillatory nature of $f$, and the infinite sums (which are fortunately moderated by the fact that the negative exponential is going to decay rapidly), I'd appreciate guidance as to the overall approach (in terms of functions and options) to ensure the accuracy I'm looking for.

Function

$$ \begin{align} f(n, a, w) &= \frac{1}{n} \left(w^2+\frac{a^2}{12}+4 \sum _{k=1}^{\infty } \left((-1)^k \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \left(w^2+\frac{a^2}{4 k^2 \pi ^2}\right) \cos \left(\frac{2 \pi p k}{a}\right)-\frac{a^2}{\pi ^2} S^2\right)\right) \\ &-\left(p+\frac{a}{\pi } S \right)^2-\frac{2 p }{n} \left(p+\frac{a S}{\pi }\right)+p^2 \end{align} $$

where $$ S = \sum _{j=1}^{\infty } \frac{(-1)^j }{j} \: \exp \left(-\frac{2 j^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 j \pi p}{a}\right) $$

Mathematica code

F[n_, a_, w_] := (1/n) * (w^2 + a^2/12 + 4 * Sum[(-1)^k * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * (w^2 + a^2/(4 * k^2 * Pi^2)) * Cos[(2 * Pi * p * k)/a] - (a^2/Pi^2) * S^2, {k, 1, Infinity}]) - (p + (a/Pi) * S)^2 - ((2 * p)/ n) * (p + (a/Pi) * S) + p^2

with

S = Sum[((-1)^j/j) * Exp[-((2 * j^2 * Pi^2 * w^2)/a^2)] * Sin[(2 * j * Pi * p)/a],{j, 1, Infinity}]

Edited: Following the suggestion of @Bill, I have changed the variable of summation in $S$ to $j$ for the sake of clarity.

I would like to be able to evaluate, numerically, the function $f(n, a, w)$ shown below so that I can:

  • integrate $f(n, a, w)$ over the range $[0 \le p \le 1]$ for various positive integer $n < 50$ real $0 < a < 5$;

  • graphically explore the relationship between the value of the integral and $w$ for the those same values of $n$ and $a$;

  • estimate, within about $0.005$, the value of $w$ that minimizes the integral for the same $n$ and $a$.

I have more experience with Mathematica's symbolic capabilities than with the numerical side . Given the oscillatory nature of $f$, and the infinite sums (which are fortunately moderated by the fact that the negative exponential is going to decay rapidly), I'd appreciate guidance as to the overall approach (in terms of functions and options) to ensure the accuracy I'm looking for.

Function

$$ \begin{align} f(n, a, w) &= \frac{1}{n} \left(w^2+\frac{a^2}{12}+4 \sum _{k=1}^{\infty } \left((-1)^k \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \left(w^2+\frac{a^2}{4 k^2 \pi ^2}\right) \cos \left(\frac{2 \pi p k}{a}\right)-\frac{a^2}{\pi ^2} S^2\right)\right) \\ &-\left(p+\frac{a}{\pi } S \right)^2-\frac{2 p }{n} \left(p+\frac{a S}{\pi }\right)+p^2 \end{align} $$

where $$ S = \sum _{j=1}^{\infty } \frac{(-1)^j }{j} \: \exp \left(-\frac{2 j^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 j \pi p}{a}\right) $$

Mathematica code

F[n_, a_, w_] := (1/n) * (w^2 + a^2/12 + 4 * Sum[(-1)^k * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * (w^2 + a^2/(4 * k^2 * Pi^2)) * Cos[(2 * Pi * p * k)/a] - (a^2/Pi^2) * S^2, {k, 1, Infinity}]) - (p + (a/Pi) * S)^2 - ((2 * p)/ n) * (p + (a/Pi) * S) + p^2

with

S = Sum[((-1)^j/j) * Exp[-((2 * j^2 * Pi^2 * w^2)/a^2)] * Sin[(2 * j * Pi * p)/a],{j, 1, Infinity}]

Edited: Following the suggestion of @Bill, I have changed the variable of summation in $S$ to $j$ for the sake of clarity.

I would like to be able to evaluate, numerically, the function $f(n, a, w)$ shown below so that I can:

  • integrate $f(n, a, w)$ over the range $[0 \le p \le 1]$ for various positive integer $n < 50$ real $0 < a < 5$ (I'm particularly interested in the range $1/50 < a < 3/2$ );

  • graphically explore the relationship between the value of the integral and $w$ for the those same values of $n$ and $a$;

  • estimate, within about $0.005$, the value of $w$ that minimizes the integral for the same $n$ and $a$.

I have more experience with Mathematica's symbolic capabilities than with the numerical side . Given the oscillatory nature of $f$, and the infinite sums (which are fortunately moderated by the fact that the negative exponential is going to decay rapidly), I'd appreciate guidance as to the overall approach (in terms of functions and options) to ensure the accuracy I'm looking for.

Function

$$ \begin{align} f(n, a, w) &= \frac{1}{n} \left(w^2+\frac{a^2}{12}+4 \sum _{k=1}^{\infty } \left((-1)^k \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \left(w^2+\frac{a^2}{4 k^2 \pi ^2}\right) \cos \left(\frac{2 \pi p k}{a}\right)-\frac{a^2}{\pi ^2} S^2\right)\right) \\ &-\left(p+\frac{a}{\pi } S \right)^2-\frac{2 p }{n} \left(p+\frac{a S}{\pi }\right)+p^2 \end{align} $$

where $$ S = \sum _{j=1}^{\infty } \frac{(-1)^j }{j} \: \exp \left(-\frac{2 j^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 j \pi p}{a}\right) $$

Mathematica code

F[n_, a_, w_] := (1/n) * (w^2 + a^2/12 + 4 * Sum[(-1)^k * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * (w^2 + a^2/(4 * k^2 * Pi^2)) * Cos[(2 * Pi * p * k)/a] - (a^2/Pi^2) * S^2, {k, 1, Infinity}]) - (p + (a/Pi) * S)^2 - ((2 * p)/ n) * (p + (a/Pi) * S) + p^2

with

S = Sum[((-1)^j/j) * Exp[-((2 * j^2 * Pi^2 * w^2)/a^2)] * Sin[(2 * j * Pi * p)/a],{j, 1, Infinity}]

Edited: Following the suggestion of @Bill, I have changed the variable of summation in $S$ to $j$ for the sake of clarity.

Notice added Draw attention by CrimsonDark
Bounty Started worth 50 reputation by CrimsonDark
Minor corrects to variable types
Source Link
CrimsonDark
  • 421
  • 2
  • 12

I would like to be able to evaluate, numerically, the function $f(n, a, w)$ shown below so that I can:

  • integrate $f(n, a, w)$ over the range $[0 \le p \le 1]$ for various positive integer $n < 50$ and real $a < 100$$0 < a < 5$;

  • graphically explore the relationship between the value of the integral and $w$ for the those same values of $n$ and $a$;

  • estimate, within about $0.005$, the value of $w$ that minimizes the integral for the same $n$ and $a$.

I have more experience with Mathematica's symbolic capabilities than with the numerical side . Given the oscillatory nature of $f$, and the infinite sums (which are fortunately moderated by the fact that the negative exponential is going to decay rapidly), I'm unsure ofI'd appreciate guidance as to the best overall approach (in terms of functions and options)overall approach (in terms of functions and options) to ensure the accuracy I'm looking for.

Function

$$ \begin{align} f(n, a, w) &= \frac{1}{n} \left(w^2+\frac{a^2}{12}+4 \sum _{k=1}^{\infty } \left((-1)^k \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \left(w^2+\frac{a^2}{4 k^2 \pi ^2}\right) \cos \left(\frac{2 \pi p k}{a}\right)-\frac{a^2}{\pi ^2} S^2\right)\right) \\ &-\left(p+\frac{a}{\pi } S \right)^2-\frac{2 p }{n} \left(p+\frac{a S}{\pi }\right)+p^2 \end{align} $$

where $$ S = \sum _{j=1}^{\infty } \frac{(-1)^j }{j} \: \exp \left(-\frac{2 j^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 j \pi p}{a}\right) $$

Mathematica code

F[n_, a_, w_] := (1/n) * (w^2 + a^2/12 + 4 * Sum[(-1)^k * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * (w^2 + a^2/(4 * k^2 * Pi^2)) * Cos[(2 * Pi * p * k)/a] - (a^2/Pi^2) * S^2, {k, 1, Infinity}]) - (p + (a/Pi) * S)^2 - ((2 * p)/ n) * (p + (a/Pi) * S) + p^2

with

S = Sum[((-1)^j/j) * Exp[-((2 * j^2 * Pi^2 * w^2)/a^2)] * Sin[(2 * j * Pi * p)/a],{j, 1, Infinity}]

Edited: Following the suggestion of @Bill, I have changed the variable of summation in $S$ to $j$ for the sake of clarity.

I would like to be able to evaluate, numerically, the function $f(n, a, w)$ shown below so that I can:

  • integrate $f(n, a, w)$ over the range $[0 \le p \le 1]$ for various positive integer $n < 50$ and $a < 100$;

  • graphically explore the relationship between the value of the integral and $w$ for the those same values of $n$ and $a$;

  • estimate, within about $0.005$, the value of $w$ that minimizes the integral for the same $n$ and $a$.

I have more experience with Mathematica's symbolic capabilities than with the numerical side . Given the oscillatory nature of $f$, and the infinite sums (which are fortunately moderated by the fact that the negative exponential is going to decay rapidly), I'm unsure of the best overall approach (in terms of functions and options) to ensure the accuracy I'm looking for.

Function

$$ \begin{align} f(n, a, w) &= \frac{1}{n} \left(w^2+\frac{a^2}{12}+4 \sum _{k=1}^{\infty } \left((-1)^k \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \left(w^2+\frac{a^2}{4 k^2 \pi ^2}\right) \cos \left(\frac{2 \pi p k}{a}\right)-\frac{a^2}{\pi ^2} S^2\right)\right) \\ &-\left(p+\frac{a}{\pi } S \right)^2-\frac{2 p }{n} \left(p+\frac{a S}{\pi }\right)+p^2 \end{align} $$

where $$ S = \sum _{j=1}^{\infty } \frac{(-1)^j }{j} \: \exp \left(-\frac{2 j^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 j \pi p}{a}\right) $$

Mathematica code

F[n_, a_, w_] := (1/n) * (w^2 + a^2/12 + 4 * Sum[(-1)^k * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * (w^2 + a^2/(4 * k^2 * Pi^2)) * Cos[(2 * Pi * p * k)/a] - (a^2/Pi^2) * S^2, {k, 1, Infinity}]) - (p + (a/Pi) * S)^2 - ((2 * p)/ n) * (p + (a/Pi) * S) + p^2

with

S = Sum[((-1)^j/j) * Exp[-((2 * j^2 * Pi^2 * w^2)/a^2)] * Sin[(2 * j * Pi * p)/a],{j, 1, Infinity}]

Edited: Following the suggestion of @Bill, I have changed the variable of summation in $S$ to $j$ for the sake of clarity.

I would like to be able to evaluate, numerically, the function $f(n, a, w)$ shown below so that I can:

  • integrate $f(n, a, w)$ over the range $[0 \le p \le 1]$ for various positive integer $n < 50$ real $0 < a < 5$;

  • graphically explore the relationship between the value of the integral and $w$ for the those same values of $n$ and $a$;

  • estimate, within about $0.005$, the value of $w$ that minimizes the integral for the same $n$ and $a$.

I have more experience with Mathematica's symbolic capabilities than with the numerical side . Given the oscillatory nature of $f$, and the infinite sums (which are fortunately moderated by the fact that the negative exponential is going to decay rapidly), I'd appreciate guidance as to the overall approach (in terms of functions and options) to ensure the accuracy I'm looking for.

Function

$$ \begin{align} f(n, a, w) &= \frac{1}{n} \left(w^2+\frac{a^2}{12}+4 \sum _{k=1}^{\infty } \left((-1)^k \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \left(w^2+\frac{a^2}{4 k^2 \pi ^2}\right) \cos \left(\frac{2 \pi p k}{a}\right)-\frac{a^2}{\pi ^2} S^2\right)\right) \\ &-\left(p+\frac{a}{\pi } S \right)^2-\frac{2 p }{n} \left(p+\frac{a S}{\pi }\right)+p^2 \end{align} $$

where $$ S = \sum _{j=1}^{\infty } \frac{(-1)^j }{j} \: \exp \left(-\frac{2 j^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 j \pi p}{a}\right) $$

Mathematica code

F[n_, a_, w_] := (1/n) * (w^2 + a^2/12 + 4 * Sum[(-1)^k * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * (w^2 + a^2/(4 * k^2 * Pi^2)) * Cos[(2 * Pi * p * k)/a] - (a^2/Pi^2) * S^2, {k, 1, Infinity}]) - (p + (a/Pi) * S)^2 - ((2 * p)/ n) * (p + (a/Pi) * S) + p^2

with

S = Sum[((-1)^j/j) * Exp[-((2 * j^2 * Pi^2 * w^2)/a^2)] * Sin[(2 * j * Pi * p)/a],{j, 1, Infinity}]

Edited: Following the suggestion of @Bill, I have changed the variable of summation in $S$ to $j$ for the sake of clarity.

Minor edit. Change, for the sake of clarity, in the name of an index variable
Source Link
CrimsonDark
  • 421
  • 2
  • 12

I would like to be able to evaluate, numerically, the function $f(n, a, w)$ shown below so that I can:

  • integrate $f(n, a, w)$ over the range $[0 \le p \le 1]$ for various positive integer $n < 50$ and $a < 100$;

  • graphically explore the relationship between the value of the integral and $w$ for the those same values of $n$ and $a$;

  • estimate, within about $0.005$, the value of $w$ that minimizes the integral for the same $n$ and $a$.

I have more experience with Mathematica's symbolic capabilities than with the numerical side . Given the oscillatory nature of $f$, and the infinite sums (which are fortunately moderated by the fact that the negative exponential is going to decay rapidly), I'm unsure of the best overall approach (in terms of functions and options) to ensure the accuracy I'm looking for.

Function

$$ \begin{align} f(n, a, w) &= \frac{1}{n} \left(w^2+\frac{a^2}{12}+4 \sum _{k=1}^{\infty } \left((-1)^k \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \left(w^2+\frac{a^2}{4 k^2 \pi ^2}\right) \cos \left(\frac{2 \pi p k}{a}\right)-\frac{a^2}{\pi ^2} S^2\right)\right) \\ &-\left(p+\frac{a}{\pi } S \right)^2-\frac{2 p }{n} \left(p+\frac{a S}{\pi }\right)+p^2 \end{align} $$

where $$ S = \sum _{k=1}^{\infty } \frac{(-1)^k }{k} \: \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 k \pi p}{a}\right) $$$$ S = \sum _{j=1}^{\infty } \frac{(-1)^j }{j} \: \exp \left(-\frac{2 j^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 j \pi p}{a}\right) $$

Mathematica code

F[n_, a_, w_] := (1/n) * (w^2 + a^2/12 + 4 * Sum[(-1)^k * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * (w^2 + a^2/(4 * k^2 * Pi^2)) * Cos[(2 * Pi * p * k)/a] - (a^2/Pi^2) * S^2, {k, 1, Infinity}]) - (p + (a/Pi) * S)^2 - ((2 * p)/ n) * (p + (a/Pi) * S) + p^2

with

S = Sum[((-1)^k^j/kj) * Exp[-((2 * k^2j^2 * Pi^2 * w^2)/a^2)] * Sin[(2 * kj * Pi * p)/a],{kj, 1, Infinity}]

Edited: Following the suggestion of @Bill, I have changed the variable of summation in $S$ to $j$ for the sake of clarity.

I would like to be able to evaluate, numerically, the function $f(n, a, w)$ shown below so that I can:

  • integrate $f(n, a, w)$ over the range $[0 \le p \le 1]$ for various positive integer $n < 50$ and $a < 100$;

  • graphically explore the relationship between the value of the integral and $w$ for the those same values of $n$ and $a$;

  • estimate, within about $0.005$, the value of $w$ that minimizes the integral for the same $n$ and $a$.

I have more experience with Mathematica's symbolic capabilities than with the numerical side . Given the oscillatory nature of $f$, and the infinite sums (which are fortunately moderated by the fact that the negative exponential is going to decay rapidly), I'm unsure of the best overall approach (in terms of functions and options) to ensure the accuracy I'm looking for.

Function

$$ \begin{align} f(n, a, w) &= \frac{1}{n} \left(w^2+\frac{a^2}{12}+4 \sum _{k=1}^{\infty } \left((-1)^k \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \left(w^2+\frac{a^2}{4 k^2 \pi ^2}\right) \cos \left(\frac{2 \pi p k}{a}\right)-\frac{a^2}{\pi ^2} S^2\right)\right) \\ &-\left(p+\frac{a}{\pi } S \right)^2-\frac{2 p }{n} \left(p+\frac{a S}{\pi }\right)+p^2 \end{align} $$

where $$ S = \sum _{k=1}^{\infty } \frac{(-1)^k }{k} \: \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 k \pi p}{a}\right) $$

Mathematica code

F[n_, a_, w_] := (1/n) * (w^2 + a^2/12 + 4 * Sum[(-1)^k * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * (w^2 + a^2/(4 * k^2 * Pi^2)) * Cos[(2 * Pi * p * k)/a] - (a^2/Pi^2) * S^2, {k, 1, Infinity}]) - (p + (a/Pi) * S)^2 - ((2 * p)/ n) * (p + (a/Pi) * S) + p^2

with

S = Sum[((-1)^k/k) * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * Sin[(2 * k * Pi * p)/a],{k, 1, Infinity}]

I would like to be able to evaluate, numerically, the function $f(n, a, w)$ shown below so that I can:

  • integrate $f(n, a, w)$ over the range $[0 \le p \le 1]$ for various positive integer $n < 50$ and $a < 100$;

  • graphically explore the relationship between the value of the integral and $w$ for the those same values of $n$ and $a$;

  • estimate, within about $0.005$, the value of $w$ that minimizes the integral for the same $n$ and $a$.

I have more experience with Mathematica's symbolic capabilities than with the numerical side . Given the oscillatory nature of $f$, and the infinite sums (which are fortunately moderated by the fact that the negative exponential is going to decay rapidly), I'm unsure of the best overall approach (in terms of functions and options) to ensure the accuracy I'm looking for.

Function

$$ \begin{align} f(n, a, w) &= \frac{1}{n} \left(w^2+\frac{a^2}{12}+4 \sum _{k=1}^{\infty } \left((-1)^k \exp \left(-\frac{2 k^2 \pi ^2 w^2}{a^2}\right) \left(w^2+\frac{a^2}{4 k^2 \pi ^2}\right) \cos \left(\frac{2 \pi p k}{a}\right)-\frac{a^2}{\pi ^2} S^2\right)\right) \\ &-\left(p+\frac{a}{\pi } S \right)^2-\frac{2 p }{n} \left(p+\frac{a S}{\pi }\right)+p^2 \end{align} $$

where $$ S = \sum _{j=1}^{\infty } \frac{(-1)^j }{j} \: \exp \left(-\frac{2 j^2 \pi ^2 w^2}{a^2}\right) \sin \left(\frac{2 j \pi p}{a}\right) $$

Mathematica code

F[n_, a_, w_] := (1/n) * (w^2 + a^2/12 + 4 * Sum[(-1)^k * Exp[-((2 * k^2 * Pi^2 * w^2)/a^2)] * (w^2 + a^2/(4 * k^2 * Pi^2)) * Cos[(2 * Pi * p * k)/a] - (a^2/Pi^2) * S^2, {k, 1, Infinity}]) - (p + (a/Pi) * S)^2 - ((2 * p)/ n) * (p + (a/Pi) * S) + p^2

with

S = Sum[((-1)^j/j) * Exp[-((2 * j^2 * Pi^2 * w^2)/a^2)] * Sin[(2 * j * Pi * p)/a],{j, 1, Infinity}]

Edited: Following the suggestion of @Bill, I have changed the variable of summation in $S$ to $j$ for the sake of clarity.

split equation over two lines
Source Link
CrimsonDark
  • 421
  • 2
  • 12
Loading
corrected a type that incorrectly stated what I want to minimize
Source Link
CrimsonDark
  • 421
  • 2
  • 12
Loading
Source Link
CrimsonDark
  • 421
  • 2
  • 12
Loading