Martin Larsen on Sun, 13 Nov 2005 13:54:56 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Little problems



On Sat, Nov 12, 2005 at 11:35:44PM +0100, Martin Larsen wrote:
First this:
acos(cos(I))
 *** acos: bug in GP (Segmentation Fault), please report

Apparently, you are using PARI/GP 2.2.9. This bug was not
present in previous releases and was fixed in PARI/GP 2.2.10.
I would suggest you to upgrade to PARI/GP 2.2.11.

Then this:

a=matid(8);

Now I will try to generate a matrix recursively.
Only s[1,] is importent at start.

I suppose you mean a[1,] ?

Yes typo sorry.

It's repeated 3 times make the error clear.
3. time is correct. If I do the same thing with
2 for-loops the correct result is there 1. time.

matrix(6,6,i,j,a[i+1,j+1]=a[i,j]+3*a[i,j+1]+2*a[i,j+2])

In case it is not clear: what you do is equivalent to

for(i=1,6,for(j=1,6,a[i+1,j+1]=a[i,j]+3*a[i,j+1]+2*a[i,j+2]));
matrix(6,6,i,j,a[i+1,j+1])

You are modifying the matrix 'a' each time, so you will not get
the same result unless you reset 'a' with a=matid(8);

I'm not modifying 1. row!
Look at the output fom your code:

[1 0 0 0 0 0 0 0]

[0 1 0 0 0 0 0 0]

[0 3 1 0 0 0 0 0]

[0 11 6 1 0 0 0 0]

[0 45 31 9 1 0 0 0]

[0 197 156 60 12 1 0 0]

[0 903 785 360 98 15 1 0]

[0 0 0 0 0 0 0 1]

compare to the other output:

[1 0 0 0 0 0]

[3 1 0 0 0 0]

[11 6 1 0 0 0]

[33 31 9 1 0 0]

[99 126 60 12 1 0]

[297 477 306 98 15 1]

(Remember!! to have a=matid(8) first.)


I suppose it is a bug in Pari (?)

It is not a bug: you are changing the matrix a.

Another thing: if I do this (it's only working with the letter 'i')
5^i , then my inputline look like this

(could I have this explained).

Are you using the Windows version ?  Maybe the system translated
^i to î, or something.

Yes. I don't see this in other programs.

It might be related to bug #102, see
<http://pari.math.u-bordeaux.fr/Bugs/102>

Or maybe I completly misunderstood you.

Cheers,
Bill.