I have been looking over and interpreting some sample code and am having some trouble understanding what is going on with a bit of slicing syntax. For some context I am working on a computational program that uses method of finite differences approximating temperatures over a square region.
Here is some of the code:
maxIter = 500 lenX = lenY = 20 delta = 1 Ttop = 100 Tbottom = 0 Tleft = 0 Tright = 0 Tguess = 30 T = np.empty((lenX, lenY)) T.fill(Tguess) T[(lenY-1):, :] = Ttop T[:1, :] = Tbottom T[:, (lenX-1):] = Tright T[:, :1] = Tleft
the last bit is what I am having trouble understanding. I am unsure exactly what the placement of the colons and commas are doing in the T[] boundary conditions. The next part of the code proceeds with for loops with T[i,j].
Like looking at the first one it seems to say in first index of T slice from 9 (lenY-1) to the end of the list and in the second index dont slice anything, then it sets that to 100. I understand this is making the temp along the top boundary 100, I am just not sure how that is happening from the syntax present.
T[a:b,c:d] references the square matrix formed by the intersection of the rows a, a+1 ....b-1 and the columns c,c+1,....d-1
If a: is given it means that it is a: end where the end is the references the next address of the last element
If: a is given it means that it is begin:a where begin is the address of the first element
Consider T[(lenY-1):,:] = T[(lenY-1):end,begin:end] = T[lenY-1,begin:end] So we are essentially accessing the entire last row
Similarly T[:1,:] accesses the entire first row
T[:,(lenX-1):] accesses the entire last column
T[:,:1] accesses the entire first column
I have been looking over and interpreting some sample code and am having some trouble understanding...
I am having trouble understanding and interpreting relative risk in a cohort study. From my understanding, it is the ratio of the risk of an exposed group to a risk of a nonexposed group. I do not understand how to interpret the ratio if it's more than 1, less than 1, or equals 1. I do not understand what it means when something has a positive association or negative association.
Hey I have this assignment I am having trouble understanding how to interact with the ac current in Ohms law. Please show all steps! Thank you! (1 fxii) if Is-(2/30°) A in the circuit below, use phasors and nodal analysis to find ½ IB -j5 Ω 1020 A 6Ω 3Ω V2
I have asked this question before but I am having trouble understanding it. If anyone could help explain it to me it would be appreciated please! What is the gauge pressure just behind a closed faucet (at sea level) that supplies water from a water tower whose top water surface is 31 m above? a. 6 atm b. 3 atm c. 7.2 atm d. 4.8 atm
Looking for help in service marketing assignment. There are some question I am trouble to answer. Assignmet is about Servuction Model in airline industry. Here are some questions: 1 What is the relevancy, critics and/or recommendation of the application of servuction model? 2 Does the model explain fully for all services, including low-contact and high contact service?
I am having trouble understanding why the change in A/R is not 49,000. I have also tried (49,000) as well, and a number of other possible solutions. There must be something I am missing. Assistance would be appreciated. Will rate quickly. Thank you. Adjusting Cash Flows for Changes in Accounts Receivable Marshall Inc. had beginning balances (January 1) of $200,000 and $5,000 for accounts receivable and the allowance for doubtful accounts, respectively. During the year, the company had the following...
This needs to be in python, however, I am having trouble with the code. Is there any way to use the code that I already have under the main method? If so, what would be the rest of the code to finish it? #Create main method def main(): #Create empty list list=[] #Display to screen print("Please enter a 3 x 4 array:") #Create loop for rows and have each entered number added to list for i in range(3): list.append([int(x) for...
Could you please post a detailed answer for both parts I am having trouble understanding one of the solutions I found in the book. 1.45** Prove that if v(t) is any vector that depends on time (for example the velocity of a moving particle) but which has constant magnitude, then v(t) is orthogonal to v(t). Prove the converse that if v(t) is orthogonal to v(t), then [v(t) is constant. (Hint: Consider the derivative of v2.] This is a very handy...
I having some trouble solving this boundary value problem. Thank you for your assistance. A thin wire coinciding with the x-axis on the interval [-L. L] is bent into the shape of a circle so that the ends x =-1 and x = L are joined. Under certain conditions, the temperature u(r, t) in the wire satisfies the boundary- value problem a au ot 11(-L. ) = u(Lt), t > 0 du ou .tso 11(x, 0) =fo), -L < x...
I am having trouble understanding this question. I don't need every single value worked out I just want to understand what to do so I can work the rest out myself! The question is written exactly as writtten: The pK of an acid is 4.16. Calculate the pH of a solution of the acid if it is titrated to the following extents. Use the value associated with your student ID: extent of titration with NaOH, percent 0 1 2 3...
C++ language I am having some trouble with user validation, can someone look at my code and tell me what I am doing wrong: char firstInital, lastInitial; int userAge; std::cout << "Program 1-2: Get user initials and age in days\n "; std::cout << "-------------------------------------------------------------------------\n"; std::cout << "Please enter the first letter of your first name: \n " << flush; std::cin >> firstInital; std::cout << "Please enter the first letter of your last name: \n...