An integration question



* Barton Willis <willisb at unk.edu> [2007-08-20 12:05:36 -0500]:

> This seems to be a bug introduced by recent changes to %piargs:
> 
> (%i1)
> integrate(cos(x)-cos(x-c),x,0,c/2)=%pi-c-integrate(cos(x-c),x,c,%pi/2+c);
> Is  c   positive, negative, or zero? pos;
> (%o1) 2*sin(c/2)-sin(c)=-c+sin((4*%pi*false-%pi)/2)-sin(2*%pi*false)+%pi
> 
> (%i2) %piargs : false$
> (%i3)
> integrate(cos(x)-cos(x-c),x,0,c/2)=%pi-c-integrate(cos(x-c),x,c,%pi/2+c);
> 
> Is  c   positive, negative, or zero? pos;
> (%o3) -sin(c)+2*sin(c/2)-sin(0)=-c-sin(%pi/2)+sin(0)+%pi
> 
> Barton
> 

Thanks! Now, sin(%pi/2) is not simplified, probably because %piargs is
false. Is sin(0) left unsimplified because of the same reason?

BTW, I wanted to solve %o3 for c using newton, from
.../share/numeric/newton1.mac, but it returned a huge mess, which
after an additional %,numer; returned 1.66..., as I expected. The
issue is, how to make sure that newton always returns a float, so that
a user does not have to go through an additional "%,numer"? In this
particular case, I modified the line "xn: ....", in my copy of
newton1.mac, to "xn:float(....)", and it did the job. Note newton1.mac
has "numer : true" within the block, but aparently that is not enough
to guarantee a float point return. I don't know whether this ad hoc
fix I made is a good solution in general, but I propose newton1.mac be
modified appropriately. 

Milan

> -----maxima-bounces at math.utexas.edu wrote: -----
> 
> >To: maxima at math.utexas.edu
> >From: "'Milan Lukic'" <milan at eskimo.com>
> >Sent by: maxima-bounces at math.utexas.edu
> >Date: 08/20/2007 11:47AM
> >Subject: Re: [Maxima] An integration question
> >
> >Thank you Richard and Stavros. Since this bug seem to be introduced
> >after Maxima 5.12, I suspect that instead of filling a bug report, it
> >would be better to fix the problem before releasing 5.13.
> >
> >Milan
> >
> >* Richard Fateman <fateman at cs.berkeley.edu> [2007-08-20 09:43:05
> >-0700]:
> >
> >> Clearly this is a bug.
> >>
> >> -----Original Message-----
> >> From: maxima-bounces at math.utexas.edu
> >[mailto:maxima-bounces at math.utexas.edu]
> >> On Behalf Of Milan Lukic
> >> Sent: Monday, August 20, 2007 9:29 AM
> >> To: maxima at math.utexas.edu
> >> Subject: An integration question
> >>
> >> I don't understand how/why Maxima returns the following:
> >>
> >> (%i3)
> >>
> >integrate(cos(x)-cos(x-c),x,0,c/2)=%pi-c-integrate(cos(x-c),x,c,%pi/2+c);
> >> Is  c  positive, negative, or zero?
> >>
> >> pos;
> >> (%o3) 2*sin(c/2)-sin(c) =
> >-c+sin((4*%pi*false-%pi)/2)-sin(2*%pi*false)+%pi
> >>
> >> What is this "false" doing in the answer? In case it plays any role,
> >> here is the build_info:
> >>
> >>
> >> _______________________________________________
> >> Maxima mailing list
> >> Maxima at math.utexas.edu
> >> http://www.math.utexas.edu/mailman/listinfo/maxima
> >
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima

--