Linear Algebra - How do I put the following matrix into a tridiagonal one using partial pivoting and row operations

How do I put the following matrix into a tridiagonal one using partial pivoting and row operations

0 1 3
-1 2 8
2 -1 5

First I swapped rows 1 and 3 to get the largest absolute pivot/diagonal entry

2 -1 5
-1 2 8
0 1 3

Then I took R2 <-- 2R2 + R1

2 -1 5
0 3 21
0 1 3

I'm unsure how to get that 21 in the bottom position in the last column as it will effect the diagonal entry in column 2. Unless I am doing this wrong, any help is appreciated.

πŸ‘︎ 2
πŸ’¬︎
πŸ“…︎ Nov 05 2021
🚨︎ report
Eigenvalues of matrix composed of blocks of tridiagonal Toeplitz matrices

I am hoping someone can help me begin to address my deficiencies in understanding this problem. On Math Stack Exchange, the OP is asking how to find eigenvalues and eigenvectors of block Toeplitz matrices. I have a similar problem I wish to solve, but I would like to understand their work first, so my question is this:

How did the OP go from, T, a 2N-by-2N matrix, represented as the sum of tensor products (the Pauli matrix step) to T as the sum of (2-by-2) matrices after plugging in the eigenvalues of each (N-by-N) sub-block of T?

I understand that the eigenvalues of the tridiagonal Toeplitz matrices fill each of the elements of the 2-by-2 representation of T, and also that the eigenvectors of tridiagonal N-by-N Toeplitz matrices (e.g., A, B, etc) are all the same, and thus simultaneously diagonalize all blocks of T(2N-by-2N).

Thanks for the help!

πŸ‘︎ 21
πŸ’¬︎
πŸ‘€︎ u/the-alchemist11
πŸ“…︎ Apr 08 2021
🚨︎ report
Optimizing Solver for Almost Tridiagonal Matrix

I have a working subroutine for solving a tridiagonal matrix with periodic boundary conditions (this is the problem formulation). I have modified this subroutine in order to preserve the matrix. Here is what I have,

subroutine triper_vec(dl, dm, du, b, x, n)
    integer, intent(in) :: n
    double precision, intent(in) :: dl(:)   ! lower-diagonal
    double precision, intent(in) :: dm(:)   ! main-diagonal
    double precision, intent(in) :: du(:)   ! upper-diagonal
    double precision, intent(in) :: b(:)    ! b vector
    double precision, intent(inout) :: x(:) ! output

    double precision, dimension(n) :: w     ! work array
    double precision, dimension(n) :: maind ! used to preserve matrix
    integer :: i, ii
    double precision :: fac

    w(1) = -dl(1)
    maind(1) = dm(1)
    x(1) = b(1)
    do i = 2, n - 1, 1
        ii = i - 1
        fac = dl(i) / maind(ii)
        maind(i) = dm(i) - (fac * du(ii))
        x(i) = b(i) - (fac * x(ii))
        w(i) = -fac * w(ii)
    end do
    x(n) = b(n)
    maind(n) = dm(n)

    ii = n - 1
    x(ii) = x(ii) / maind(ii)
    w(ii) = (w(ii) - du(ii)) / maind(ii)

    do i = n - 2, 1, -1
        ii = i + 1
        x(i) = (x(i) - du(i) * x(ii)) / maind(i)
        w(i) = (w(i) - du(i) * w(ii)) / maind(i)
    end do

    i = n
    ii = n - 1
    fac = maind(i) + (du(i) * w(1)) + (dl(i) * w(ii))
    x(i) = (x(i) - ((du(i) * x(1)) + (dl(i) * x(ii)))) / fac

    fac = x(n)
    do i = 1, n - 1, 1
        x(i) = x(i) + (w(i) * fac)
    end do

end subroutine triper_vec

Are there any glaring issues that could lead to performance increases? Or is there anything I can do to allow the compiler to produce a more optimized result? I am compiling with

gfortran -march=native -O3 triper.f90
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/vlovero
πŸ“…︎ Jan 26 2021
🚨︎ report
[Linear Algebra] - Showing that the eigenvalues of a tridiagonal matrix are all strictly positive

Hello,

I am having trouble showing that the eigenvalues of a tridiagonal matrix are all strictly positive. The tridiagonal matrix has 2's along the main diagonal and -1's directly above and below the main diagonal, and every other entry is 0. Help is appreciated!

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Sky_Lyte_Shaymin
πŸ“…︎ Apr 01 2017
🚨︎ report
Standard tridiagonal matrix Eigenvalue decomposition algorithm?

Hi I am trying to generate an arbitrary Gauss quadrature rule by using the Golub-Welsh algorithm (here). I need to code this on C++ for my personal project. This algorithm involves the eigenvalue decomposition of a matrix in which the only non-zero elements are the subdiagonal and superdiagonal. To illustrate in Matlab code: n = 16; beta = .5./sqrt(1-(2*(1:n-1)).-2); T = diag(beta,1) + diag(beta,-1); [V,D] = eig(T); I want to implement the eigenvalue decomposition in code and not use Matlab routines for this since I want to parallelize it. What is the best way to do eigenvalue decomposition for this type of matrix? Is bisection method acceptable for my use case? How about divide and conquer or QR method or Lanczos? I expect the n to be upto 512.

EDIT: the MRRR technique was pointed to me in another forum. It is a relatively new technique developed by Dhillon and Parlett. Apparently it has extremely good time complexity and has a guaranteed accuracy.

πŸ‘︎ 10
πŸ’¬︎
πŸ‘€︎ u/nicholasferber
πŸ“…︎ Apr 04 2014
🚨︎ report
LAPACK Subroutine for finding the eigenvalues and vectors for a non symmetric tridiagonal matrix.

I can only seem to find subroutines for general or symmetric tridiagonal matrices. Is it just me? Any answers are appreciated.

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Qqslag
πŸ“…︎ Mar 07 2015
🚨︎ report
Blind Girl Here. Give Me Your Best Blind Jokes!

Do your worst!

πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Leckzsluthor
πŸ“…︎ Jan 02 2022
🚨︎ report
What starts with a W and ends with a T

It really does, I swear!

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/PsychedeIic_Sheep
πŸ“…︎ Jan 13 2022
🚨︎ report
Dropped my best ever dad joke & no one was around to hear it

For context I'm a Refuse Driver (Garbage man) & today I was on food waste. After I'd tipped I was checking the wagon for any defects when I spotted a lone pea balanced on the lifts.

I said "hey look, an escaPEA"

No one near me but it didn't half make me laugh for a good hour or so!

Edit: I can't believe how much this has blown up. Thank you everyone I've had a blast reading through the replies πŸ˜‚

πŸ‘︎ 19k
πŸ’¬︎
πŸ‘€︎ u/Vegetable-Acadia
πŸ“…︎ Jan 11 2022
🚨︎ report
Heat transfer: explicit and implicit Euler's methods to obtain a numerical solution.

Hi,

I have been experimenting a bit with an explicit and implicit Euler's methods to solve a simple heat transfer partial differential equation:

βˆ‚T/βˆ‚t = alpha * (βˆ‚^2T/βˆ‚x^2)

T = temperature, x = axial dimension. The initial condition I used is for x = 0, T = 100 Β°C. And the boundary condition at the end of the computational grid: for T**(x = L) =** T**(x=*****L-***1), where L is a length of the computational grid -> the last and the and next-to-last values of temperature are the same.

Would some be willing to look at my code (I am not a MATLAB guy, but I try to learn) whether my implementation of implicit method is correct.

My thoughts:

Explicit method (works fine): Every values of T are calculated by T1(i) + heat_coefficient*((T1(i+1)-2*T1(i)+T1(i-1))/dx^2)*dt, except for the first and the last value which are specified by the I.C. and B.C., respectively.

My question:

Implicit method: At first, I create a tri-diagonal matrix MAT
, which defines a relationship between the values in the next time line (n+1). In the case of an implicit method, I cannot write I.C. and B.C. exactly, and therefore I save them on the β€œRight side of the equation”, i.e. pS(i) = -(T2(i)*dx^2)/(heat_coefficient*dt);

By this, I express all the values in one time line (n) and after that, I continue in the following time line (n+1).

If I put I.C. or B.C. into the β€œRight side of the equation”, the results become very sensitive to any change of positional (dx) and time (dt) step. Behavior of the temperature function is therefore wrong: the curves of a temperature should converge to the same values after certain time (if the time goes to infinity), however, my curves converge to a different values (and randomly change based on dx and dt).

How do I achieve to start at a temperature of 100 Β°C, such that after an β€œinfinitely” long time, all of the temperature curves converge to 100 Β°C?

Should the values of I.C. and B.C. be put into a tri-diagonal matrix - e.g., if I have matrix with dimensions [N,N], then I specify I.C. for point [1,1], and B.C. for point [N,N]? (Unfortunately, it did not work properly when I tried)

Also, my implementation of the tri-diagonal matrix is probably not very nice, but it works.

πŸ‘︎ 20
πŸ’¬︎
πŸ‘€︎ u/iBo0m
πŸ“…︎ Mar 31 2021
🚨︎ report
What is a a bisexual person doing when they’re not dating anybody?

They’re on standbi

πŸ‘︎ 11k
πŸ’¬︎
πŸ‘€︎ u/Toby-the-Cactus
πŸ“…︎ Jan 12 2022
🚨︎ report
What do you call quesadillas you eat in the morning?

Buenosdillas

πŸ‘︎ 12k
πŸ’¬︎
πŸ‘€︎ u/FarronKeepSucks
πŸ“…︎ Jan 14 2022
🚨︎ report
This subreddit is 10 years old now.

I'm surprised it hasn't decade.

πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/frexyincdude
πŸ“…︎ Jan 14 2022
🚨︎ report
Tridiagonal Systems help please

Our code is given down below. We have been struggling wrapping our heads around how to write this matlab code. We cannot get the correct values and have tried multiple ways to find the correct values for u. Any help would be greatly appreciated :)

clear;

A = [3 5 0 0

1 4 6 0

0 5 7 3

0 0 3 8];

k = [13 27 43 41];

a = [];

b = [];

c = [];

n = length(A);

m = n-1;

for i = 1:n

f = A(i,i);

a(i) = f;

end

for i = 1:m

p = 1 + i;

s = A(i,p);

b(i) = s;

end

for i = 1:m

p = 1 + i;

s = A(p,i);

c(i) = s;

end

for i = 1:m

f = c(i)./a(i);

R = c(i) - f*a(i);

c(i) = 0;

a(i+1) = R;

end

u = [];

%u is supposed to equal [1 2 3 4]

https://preview.redd.it/genwag3ckgq61.png?width=621&format=png&auto=webp&s=759de8e747b8fec9c0183a2ce647849e35917dff

https://preview.redd.it/kqel5i3ckgq61.png?width=590&format=png&auto=webp&s=8bc9630ec4133650059996aea2de469bb5a5fe13

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/flynnboy02
πŸ“…︎ Apr 01 2021
🚨︎ report
Geddit? No? Only me?
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/shampy311
πŸ“…︎ Dec 28 2021
🚨︎ report
I wanna hear your best airplane puns.

Pilot on me!!

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/Paulie_Felice
πŸ“…︎ Jan 07 2022
🚨︎ report
E or ß?
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Amazekam
πŸ“…︎ Jan 03 2022
🚨︎ report
No spoilers
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Onfour
πŸ“…︎ Jan 06 2022
🚨︎ report
Covid problems
πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/theincrediblebou
πŸ“…︎ Jan 12 2022
🚨︎ report
These aren't dad jokes...

Dad jokes are supposed to be jokes you can tell a kid and they will understand it and find it funny.

This sub is mostly just NSFW puns now.

If it needs a NSFW tag it's not a dad joke. There should just be a NSFW puns subreddit for that.

Edit* I'm not replying any longer and turning off notifications but to all those that say "no one cares", there sure are a lot of you arguing about it. Maybe I'm wrong but you people don't need to be rude about it. If you really don't care, don't comment.

πŸ‘︎ 12k
πŸ’¬︎
πŸ‘€︎ u/Lance986
πŸ“…︎ Dec 15 2021
🚨︎ report
I had a vasectomy because I didn’t want any kids.

When I got home, they were still there.

πŸ‘︎ 10k
πŸ’¬︎
πŸ‘€︎ u/demotrek
πŸ“…︎ Jan 13 2022
🚨︎ report
What did 0 say to 8 ?

What did 0 say to 8 ?

" Nice Belt "

So What did 3 say to 8 ?

" Hey, you two stop making out "

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/designjeevan
πŸ“…︎ Jan 03 2022
🚨︎ report
Spi__
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/Fast_Echidna_8520
πŸ“…︎ Jan 11 2022
🚨︎ report
i Karenough to
πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/Amazekam
πŸ“…︎ Jan 14 2022
🚨︎ report
I dislike karma whores who make posts that imply it's their cake day, simply for upvotes.

I won't be doing that today!

πŸ‘︎ 15k
πŸ’¬︎
πŸ‘€︎ u/djcarves
πŸ“…︎ Dec 27 2021
🚨︎ report
The Ancient Romans II
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/mordrathe
πŸ“…︎ Dec 29 2021
🚨︎ report
How do you stop Canadian bacon from curling in your frying pan?

You take away their little brooms

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/Majorpain2006
πŸ“…︎ Jan 09 2022
🚨︎ report
I did it, I finally did it. After 4 years and 92 days I went from being a father, to a dad.

This morning, my 4 year old daughter.

Daughter: I'm hungry

Me: nerves building, smile widening

Me: Hi hungry, I'm dad.

She had no idea what was going on but I finally did it.

Thank you all for listening.

πŸ‘︎ 17k
πŸ’¬︎
πŸ‘€︎ u/Sk2ec
πŸ“…︎ Jan 01 2022
🚨︎ report
It this sub dead?

There hasn't been a post all year!

πŸ‘︎ 13k
πŸ’¬︎
πŸ‘€︎ u/TheTreelo
πŸ“…︎ Jan 01 2022
🚨︎ report
School Was Clothed
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Kennydoe
πŸ“…︎ Jan 08 2022
🚨︎ report
Couch potato
πŸ‘︎ 8k
πŸ’¬︎
πŸ“…︎ Dec 31 2021
🚨︎ report
Baka!
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/ridi86
πŸ“…︎ Jan 09 2022
🚨︎ report
Letting loose with these puns
πŸ‘︎ 6k
πŸ’¬︎
πŸ“…︎ Jan 13 2022
🚨︎ report
concrete πŸ—Ώ
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Fast_Echidna_8520
πŸ“…︎ Jan 07 2022
🚨︎ report
All dad jokes are bad and here’s why

Why

πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/LordCinko
πŸ“…︎ Jan 13 2022
🚨︎ report
My name is ABCDEFGHIJKMNOPQRSTUVWXYZ

It’s pronounced β€œNoel.”

πŸ‘︎ 14k
πŸ’¬︎
πŸ‘€︎ u/beef_fried_rice
πŸ“…︎ Dec 25 2021
🚨︎ report
I'd like to dedicate this joke to my wisdom teeth.

[Removed]

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/ThoughtPumP
πŸ“…︎ Jan 14 2022
🚨︎ report
Why are people so surprised and angry about Djokovic being an anti-vaxxer?

After all his first name is No-vac

πŸ‘︎ 4k
πŸ’¬︎
πŸ‘€︎ u/hangryman23
πŸ“…︎ Jan 06 2022
🚨︎ report
That’s Michelle
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/FLEXSEALBREAKER
πŸ“…︎ Jan 10 2022
🚨︎ report
If Korean pop is shortened to Kpop and Korean Drama is Kdrama...

What, then, is Chinese rap?

Edit:

Notable mentions from the comments:

  • Spanish/Swedish/Swiss/Serbian hits

  • French/Finnish art

  • Country/Canadian rap

  • Chinese/Country/Canadian rock

  • Turkish/Tunisian/Taiwanese rap

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/hootanahalf
πŸ“…︎ Jan 09 2022
🚨︎ report
Is a 1x1 matrix tridiagonal?
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/DeliciousReport
πŸ“…︎ Jun 07 2019
🚨︎ report
Is there way to ascertain the rref of a tridiagonal matrix in a (N)x(N+1) matrix with only N operations?
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/ansariddle
πŸ“…︎ Nov 25 2016
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.