Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to create a matrix in sage that expands with a variable number of rows and columns and in each row the values are squared?

I need to make a code that takes takes two inputs: n and d and creates a matrix of the values of a list P.

'n' will be the number of columns and 'd' the number of rows.

In each row, I need the values of the following row to be raised to an incrementally rising power.

This is what I have so far:

define inputs

n=5 d=5 f=x^2

define a list of size n

P=[(i,f(i)) for i in range(n)]

define a matrix

C=matrix([(P[i][0]) for i in range(n)]) show(C)

How to create a matrix in sage that expands with a variable number of rows and columns and in each row the values are squared?

I need to make a code that takes takes two inputs: n and d and creates a matrix of the values of a list P.

'n' will be the number of columns and 'd' the number of rows.

In each row, I need the values of the following row to be raised to an incrementally rising power.

This is what I have so far:

define inputs

# inputs
n = 5
d = 5
f = x^2
  

n=5 d=5 f=x^2

define a # list of size n

P=[(i,f(i)) n P = [(i, f(i)) for i in range(n)]

range(n)] # matrix

define a matrix

C=matrix([(P[i][0]) C = matrix([(P[i][0]) for i in range(n)]) show(C)

show(C)