Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Piman9

Pages: [1]
1

I am trying to take the inverse of a 365x365 matrix. Some of the values get as large as 365**365 and so they are converted to long numbers. I don't know if the linalg.matrix_power() function can handle long numbers. I know the problem comes from this (because of the error message and because my program works just fine for smaller matrices) but I am not sure if there is a way around this. The code needs to work for a NxN matrix. Here's my code:
Code: [Select]
item=0
for i in xlist:
    xtotal.append(arrayit.arrayit(xlist[item],len(xlist)))
    item=item+1
print xtotal
xinverted=numpy.linalg.matrix_power(xtotal,-1)
coeff=numpy.dot(xinverted,ylist)
arrayit.arrayit:
Code: [Select]
def arrayit(number, length):
    newarray=[]
    import decimal
    i=0
    while i!=(length):
        newarray.insert(0,decimal.Decimal(number**i))
        i=i+1
    return newarray;
The program is taking x,y coordinates from a list (list of x's and list of y's) and makes a function. Thanks!

2
Introduce Yourself! / Hi. I'm Piman9
« on: February 05, 2015, 09:28:49 pm »
Hi. I don't personally program on any calculator except for a HP 33-S yet, but I want I start on TI soon. I need to get a TI-84 first :P. I program mainly on Python.

Pages: [1]