Issue In R, some functions only work on a data.frame and others only on a tibble or a matrix. Converting my data using as.data.frame or as.matrix often solves this, but I am wondering how the three are different ? Solution
Continue readingTag: matrix
[SOLVED] How do I write a 2D-array parameter specification in python
Issue Context I’m not used to parameter specifications when declaring a function in python. In the following example, we specify the parameters x and y to be of type int: def add(x: int, y: int) -> int: return x +
Continue reading[SOLVED] I'm having trouble with python arrays, my two-dimensional (array of arrays) has a per-row offset
Issue I cannot for the life of me spot why each row has additional leading 0’s. The array aiWalls[] defines x/y coordinates that should be a ‘1’ in the resulting array of arrays (2 dimensional array?) wallTable[]. Any coordinates in
Continue reading[SOLVED] How can I put two NumPy arrays into a matrix with two columns?
Issue I am trying to put two NumPy arrays into a matrix or horizontally stack them. Each array is 76 elements long, and I want the ending matrix to have 76 rows and 2 columns. I basically have a velocity/frequency
Continue reading[SOLVED] Vectorizing a for loop that changes columns of a matrix
Issue Say I have a vector of ages of 100 trees. Then I age those trees up for 5, 10, 15, and 20 years into the future to create a matrix of tree ages for this year and four 5-year
Continue reading[SOLVED] Fill a matrix in R based on codes
Issue I have a file with codes like this: V1 V2 1 1.0000000 2 0.2000000 3 0.5000000 4 0.0000000 And one matrix with the codes like the following: 1 1 1 1 1 1 1 3 3 3 3 3
Continue reading[SOLVED] How to loop and save values in new matrix
Issue I have the following code which identifies the velocity values at different values of KK. load(‘Vq.mat’) KK=1; ft = fftshift(fft2(Vq)); kx = [-70:1:70]; ky = [-70:1:70]; for i1=1:length(kx) for i2=1:length(ky) kh(i1,i2)=sqrt(kx(i1).^2+ky(i2).^2); if (kh(i1,i2)>KK && kh(i1,i2)<KK+1) else ft(i1,i2)=0; end end
Continue reading[SOLVED] loop though a matrix in R
Issue I try to loop trough a matrix but cant find a easy and elegant way instead of writing many (>10) equations… Can anyone help me please? My Matrix looks like this: and I want to calculate the following: (0
Continue reading[SOLVED] is it possible to generate a list in list for desired numbers?
Issue I wanted to generate a list in list : now, I have basically two options, either I input the list through a text file or I should generate the list by itself. is it possible to generate this type
Continue reading[SOLVED] c# Battleships minigame
Issue I am a begginer. I am stuck upon a problem about namimng the colums and the lines, differently than 0 to 10. something like this picture, the lines starting from the bottom 1 to 10 and colums from A
Continue reading