Agreed -- taylorinfo is just showing the info found in the underlying
representation.
But the underlying representation seems to *work* right, e.g.
taylor(x,x,0,5) + taylor(sin(x),x,0,20) => truncated at x^5
*except *for results that look like "const+...", which look buggy:
taylor(17,x,0,5) + taylor(sin(x),x,0,20) => truncated at x^20
taylor(x^6,x,0,5) + taylor(sin(x),x,0,20) => truncated at x^20
Bug RJF probably has some thoughts on this.
-s
On Fri, Dec 7, 2012 at 12:01 PM, Barton Willis <willisb at unk.edu> wrote:
> Could this be a bug in the taylor code, not taylorinfo? Example
>
> (%i1) p : taylor(0,x,0,3);
> (%o1)/T/ 0+...
>
> (%i2) q : taylor(0,x,0,42);
> (%o2)/T/ 0+...
>
> I guess the truncation stored in the (($x ((3.1)) list
>
> (%i3) ?print(p);
> ((MRAT SIMP ($X) (#:X2753) (($X ((3 . 1)) 0 NIL #:X2753 . 1)) TRUNC) 0
> . 1)
> (%o3)/T/ 0+...
>
>
> (%i4) ?print(q);
> ((MRAT SIMP ($X) (#:X2754) (($X ((42 . 1)) 0 NIL #:X2754 . 1)) TRUNC) 0
> . 1)
> (%o4)/T/ 0+...
>
> And how about the truncation of p + q? Kinda looks like its 42:
>
> (%i5) ?print(p+q);
> ((MRAT SIMP ($X) (#:X2755) (($X ((42 . 1)) 0 NIL #:X2755 . 1)) TRUNC) 0
> . 1)
> (%o5)/T/ 0+...
>
> (%i6) taylorinfo(p+q);
> (%o6) [[x,0,42]]
>
> --Barton
> ------------------------------
> *From:* macrakis at gmail.com [macrakis at gmail.com] on behalf of Stavros
> Macrakis [macrakis at alum.mit.edu]
> *Sent:* Friday, December 07, 2012 08:44
> *To:* Barton Willis; Richard Fateman
> *Cc:* Maxima - list
> *Subject:* Re: [Maxima] approx-alike bug
>
> Maybe the simplest way to do this is something like:
>
> temp:taylor(1+x+y+z,[x,0,3],[y,1,2],[z,2,1]);
> 4+(z-2)+(y-1)+x$
> taylorinfo(temp);
>
> [[x,0,3],[y,1,2],[z,2,1]]$
>
>
> Here's a case which looks like a bug in taylorinfo:
>
> (%i27) s13:taylor(sin(x),x,0,3);
> (%o27)/T/ x-x^3/6+... OK
> (%i28) s45:taylor(sin(x)^4,x,0,5);
> (%o28)/T/ x^4+... OK
> (%i29) s13+s45;
> (%o29)/T/ x-x^3/6+... OK, correctly truncated at min(3,5)
> (%i30) taylorinfo(%);
> (%o30) [[x,0,5]] So why is its taylorinfo degree 5?
>
> Am I misunderstanding the meaning of the "degree" of the expansion?
>
> -s
>
> On Thu, Dec 6, 2012 at 8:39 PM, Barton Willis <willisb at unk.edu> wrote:
>
>>
>>
>> > Hmm, I'd have thought that a regression test should check that
>> taylorinfo of two taylor expressions was the same, not just the ratdisrep.
>> The list of vars of a CRE probably doesn't matter,
>> > because the ratdisrep will be different except in degenerate cases, and
>> anyway doesn't have any mathematical importance (unlike the order of a
>> taylor expansion, which does).
>>
>> Oh, I agree. To change this, about 100 tests need to changed. Likely it
>> will be some time before I work on this. Fixing the
>> tests isn't 100% straightforward; for example the test
>>
>> taylor(1+x+y+z,[x,0,3],[y,1,2],[z,2,1]);
>> 4+(z-2)+(y-1)+x$
>>
>>
>> would need an expected output of ''
>> taylor(1+x+y+z,[x,0,3],[y,1,2],[z,2,1])" And that's silly. The next
>> test is
>>
>> 1/%;
>> 1/4-(z-2)/16+(-1/16+(z-2)/32)*(y-1)+(1/64-3*(z-2)/256)*(y-1)^2 + <more
>> stuff>
>>
>> Fixing these requires thought.
>>
>> --Barton
>>
>>
>>
>>
>>
>