# [Maxima] Cornu spiral

Edwin Woollett woollett at charter.net
Thu Dec 18 19:02:56 CST 2008

```On Dec. 8, 2008, Robert Dodier wrote:
------------------------------------
It turns out Maxima can compute the integrals symbolically.
Although %i appears in the result, the result evaluates to a
real number for real t. Maxima needs a little encouragement to
get a number instead of an expression containing %i.

One way:

assume (t > 0);
x (t) := ''(integrate (cos (s^2 * %pi/2), s, 0, t));
y (t) := ''(integrate (sin (s^2 * %pi/2), s, 0, t));
plot2d ([parametric, x, y, [t, 0, 4]], [nticks, 100], [plot_realpart,
true]);

Another way:

assume (t > 0);
x (t) := expand (''(integrate (cos (s^2 * %pi/2), s, 0, t)));
y (t) := expand (''(integrate (sin (s^2 * %pi/2), s, 0, t)));
plot2d ([parametric, x, y, [t, 0, 4]], [nticks, 100]);
----------------------------------
If I focus just on the sin^2 integral, I seem to get
inconsistent numerical results if I use
1. (bad results)  expand ( float ( ''integrate ( ... ) )  )

2. (good results)    realpart ( expand ( float ( ''integrate (...) ) ) )
---------------------------
assume(t>0)\$
display2d:false\$
fS(t) := ''(integrate(sin(s^2 * %pi/2), s, 0, t))\$

here is correct value for t = 1
realpart(expand(float(fS(1))));  --->  0.43825914739035

f2S(t):=expand(float(''( integrate (sin(s^2),s,0,t))))\$
realpart(f2S(1));  --->  0.31026830172338
f2S(1);  --->  0.31026830172338-9.8390953768041405E-17*%i

here is  good method 2

frS (t) := realpart(expand(float(''(integrate(sin (s^2 * %pi/2), s, 0,
t)))))\$
frS(1);   --->  0.43825914739035

This looks strange.

Ted Woollett

```