5
$\begingroup$

I'm playing around with Euler spirals, using a variable power to see how the plot changes,

$ \left\{\begin{matrix} x = \int_0^s \cos \left ( s^n \right ) ds \\ y = \int_0^s \sin \left ( s^n \right ) ds \end{matrix}\right. $

and finding the values for powers 2 or 3 work as expected in Mathematica:

Limit[ Integrate[Cos[s^2], {s, 0, x}], x -> ∞]
Limit[ Integrate[Sin[s^2], {s, 0, x}], x -> ∞]

$ \frac{\sqrt{\frac{\pi}{2}}}{2} \\ \frac{\sqrt{\frac{\pi}{2}}}{2} $

and similarly,

Limit[ Integrate[ Cos[s^3], {s, 0, x}], x -> ∞]
Limit[ Integrate[ Sin[s^3], {s, 0, x}], x -> ∞]

$ \frac{Gamma\left[\frac{1}{3} \right]}{2\sqrt{3}} \\ \frac{1}{6} Gamma \left [ \frac{1}{3} \right ] $

Plotting the spiral at different values (using a different general purpose graphics language) for $n$ suggests that there there should certainly be convergence values for both $x$ and $y$ for any value $1 \lt n \leq 3$ (and presumably above), but trying some of these leads to Mathematica giving most unhelpful answers:

$ Limit \left [ \int_0^s Cos \left [ s^{1.5} \right ]ds,s\rightarrow\infty \right ] \Rightarrow 0.451373 \\ Limit \left [ \int_0^s Sin \left [ s^{1.5} \right ]ds,s\rightarrow\infty \right ] \Rightarrow ComplexInfinity $

Which looks like the right $x$ coordinate, but a plain wrong $y$ coordinate, which quite clearly exists somewhere around 0.76ish:

enter image description here

Trying $n=2.5$ fails even harder, yielding "ComplexInfinity" for both coordinates, which is clearly incorrect (being somewhere near $(0.72,0.533)$):

enter image description here

Is there a way to make Mathematica generate these values anyway?

Or, is there a way to compute the general solution for symbolic power $n$ and getting a general formula for when $n\gt1$, using something like this (but then actually yielding a result):

$ Limit \left [ \int_0^s Cos \left [ s^n \right ]ds,s\rightarrow\infty \right ] \\ Limit \left [ \int_0^s Sin \left [ s^n \right ]ds,s\rightarrow\infty \right ] $

$\endgroup$
  • 3
    $\begingroup$ Limit doesn't like functions with inexact numbers. A very recent question was asked about this. Why don't you just integrate to infinity? Do this: Integrate[Cos[s^(3/2)], {s, 0, \[Infinity]}]. $\endgroup$ – march Jan 28 '16 at 4:56
  • $\begingroup$ Because for whatever reason, that did not occur to me... Works a treat, thanks! A short answer, but if you want to turn that into a real answer I'll be happy to accept it. $\endgroup$ – Mike 'Pomax' Kamermans Jan 28 '16 at 4:59
  • $\begingroup$ @Artes those edits actually made the question reflect what I have in my notebook less, and makes it harder to read the output associated with the input. I write maths as much as possible, with nice looking functions. I don't use Integral[] or the like when I can avoid it. $\endgroup$ – Mike 'Pomax' Kamermans Jan 28 '16 at 18:45
  • 2
    $\begingroup$ @Mike'Pomax'Kamermans There is a general consensus on mathematica.stackexchange that whathever code one writes, it should be in a copyable form. As you may have seen the code written in latex cannot be easily copied. On the other hand in the Front End traditional notation is equivalent to the input form (with many restrictions though). So my intervention should be welcome, nevertheless you can edit your question to its initial form. However, I recommend to edit your question adding the code you have used to plot graphs. $\endgroup$ – Artes Jan 29 '16 at 8:32
  • $\begingroup$ @Mike'Pomax'Kamermans Your graphs are slightly puzzling. I've made quite nice plots but I will be able to add them in a few days, because my version of Mathematica (10.1) involves some internal problems when exporting graphics. $\endgroup$ – Artes Jan 29 '16 at 8:33
5
$\begingroup$

The problem occurs because of apparently complex form of the expression beyond the integral of Sin[s^k]. Nevertheless it is not too harmful to proceed. Adequate limits are real and we don't need playing to simplify complex expressions to explicitly real forms.

We can calculate the both integrals with appropriate assumptions:

f[x_, k_] = Integrate[{ Cos[s^k], Sin[s^k]}, {s, 0, x}, 
                      Assumptions -> {k > 1, x > 0}];

see it in TraditionalForm:

f[x, k] // TraditionalForm

and find appropriate limits with a needed assumption:

lim[k_] = Limit[ f[x, k], x -> Infinity, Assumptions -> k > 1]
{Cos[Pi/(2 k)] Gamma[1 + 1/k], Gamma[1 + 1/k] Sin[Pi/(2 k)]}

Now we can see that indeed limits are finite for k > 1. Here we write down a few exact values as expected:

Table[{k, lim[k]}, {k, 2, 5}] // Column
{{2, {Sqrt[Pi/2]/2, Sqrt[Pi/2]/2}}, 
 {3, {1/2 Sqrt[3] Gamma[4/3], 1/2 Gamma[4/3]}},
 {4, {Cos[Pi/8] Gamma[5/4], Gamma[5/4] Sin[Pi/8]}},
 {5, {Sqrt[5/8 + Sqrt[5]/8] Gamma[6/5], 1/4 (-1 + Sqrt[5]) Gamma[6/5]}}}

We can plot adequate curves, e.g. using Quiet to avoid unneeded warnning related to apparently complex functions (involving I), nevertheless if one uses f[x,k] it is not necessary.

With[{k = 5/2}, 
  Quiet @ ParametricPlot[ f[x, k], {x, 0, 5}, PlotRange -> All]]

and find slightly improved numerical limit:

lim[2.5]
{0.717812, 0.521521}
$\endgroup$
  • $\begingroup$ I didn't know about the Assumptions operator, that's really handy. Thanks (although your edit to the question made it less reflect how I actually write my Mathematica code, so that's a little less appreciated) $\endgroup$ – Mike 'Pomax' Kamermans Jan 28 '16 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.