Hello good sir. I just wanted to say this has IMMENSELY helped me in my numerical methods course. Not only is it very structure but you go well into detail about the reasoning behind indexing and things like that. It was extremely easy to follow and I hope you liver forever!!
@reliable_tech_innovations4 жыл бұрын
can't believe somebody makes these videos.. you're a life saver
@AJ-et3vf2 жыл бұрын
Awesome video! Thank you! Well explained! I love how partial pivoting isn't actually that long and complicated to code. You're a really great teacher. Thank you!
@paulcollins14474 жыл бұрын
Thank you for these 2 excellent videos along with the python code solution. I was stumped with the b[[k,i]] = b[[i,k]] piece until I read your reply to Rafael's comment. Thanks for the explanation.
@morganvoldemort6754 жыл бұрын
at the 10 minute mark, you talk about swapping the two array rows. You put: a[[k,i]]=a[[i,k]]. is that a built in convention for arrays? I don't quite understand... what exactly is happening with this command? It has a row and column place which makes me thing specific coordinates are being replaced rather than rows. Edit: also, why do you need the break command? can't you just un-indent? (Basically what I am asking for is what is it's purpose)
@mechtutorcom4 жыл бұрын
Elements of Numpy arrays, like Python lists, can be accessed by slicing. Slicing uses built-in pre-compiled codes to return or modify elements in the arrays according to their indices. a[[k,i]]=a[[i,k]] is an application of this technique. Both k and i refer to rows not columns. k is the index of the current pivot row in the elimination process. i is index of the row that to be swapped with the k row if the condition is satisfied during the partial pivoting. The break command is used here to stop swapping of rows k and i if the condition is satisfied. If you remove the break command, the partial pivoting will continue to the last row, which will increase the run time of the code. The advantage of removing the break is that the pivot row (k) at the end will have the largest pivot element in its column. The indentation of the break statement should keep it inside the block of the condition. Otherwise, the i-loop will be exited in an uncontrolled way. Thanks for you comment.
@kevinweitgenant53004 жыл бұрын
your question helped me. thanks
@bapibasak28425 жыл бұрын
How can i program it for any input matrix instead of directly written matrix in the program?
@mechtutorcom5 жыл бұрын
You can input a matrix or a system (a-matrix & b-vector) in different ways. The simplest way is by using the Python input() function, so the user can define the matrix during the run of the code. The disadvantage of this method is that it is very tedious and error-prone to enter the matrices and vectors manually at each run, especially when they are relatively large (like 10x10 or more). The more practical method is to write the system in a text file, then open and read the file from the Python code. It is recommended for numeric data (numbers) to use CSV (Comma Separated Values) format to avoid reading errors. Since Python has tools to read from an Excel file, this could be another choice if you use Excel to save the systems. I will make a video about this topic soon. I really appreciate your question. Thank you.
@bapibasak28425 жыл бұрын
@@mechtutorcom thanks for replying...🙇🙇.I shall definitely try it.Hey...do you not think that you should extend the number of your python tutorials of numerical analysis?I like the way you explain and deserve more related videos.Thank you.
@reliable_tech_innovations4 жыл бұрын
the line b[[k,i]] = b[[i,k]], how is it possible when b is a vector?
@mechtutorcom4 жыл бұрын
A good questions! Here, I used the swap formula from Numpy. When I tried to use one dimension for [b] in this code, like b[i] = b[k] or b[[i]] = b[[k]] , it gave me totally wrong results. When I used the same formula for [a], it worked perfectly, as you see in the video. I think it works in a similar way to the swap formula by using Python tuples, like a , b = b , a , but for indexes i and k. Because Numpy uses internal algorithms for such techniques, I had to make some trials and compare them with exact solutions until I got the best working formula. I hope I could answer your question.
@hhss17633 жыл бұрын
Hi, Thanks a lot for this lecture, but how could I use it if I had a matrix with complex solutions, which mean that we are to get a complex number like x=a+bi and so on.
@danielececca40963 жыл бұрын
How this could be work whit an over-dimension or under dimension matrix