Representing non-linear reaction term in matrix form (homework 5)

Representing non-linear reaction term in matrix form (homework 5)

by Christian DiMaria -
Number of replies: 4

This is probably a very basic question, but it's been about 8 years since I've taken PDEs or linear algebra so I'll ask anyway. I understand how we represented the diffusion equation using a linear operator in Lecture 13, but I'm struggling to do the same thing with the KPP-Fisher equation in assignment 5 because of the quadratic term on the right hand side. I have been trying to represent the equation as a single matrix operating on a vector like we did on slides 19 / 20 of Lecture 13 but so far I can't figure it out.

My other idea was to have a matrix operator that accounts for the discrete spatial 2nd derivative like we did for the diffusion equation but keep the non-linear term as a separate operation. Something like the attached image, where u is a vector, A is the discrete spatial 2nd derivative, and "1" would be the identity matrix:

Screenshot%202025-03-04%20at%2010.02.43%20PM.png

I'm not sure if I'm on the right track here so any pointers would be appreciated.

In reply to Christian DiMaria

Re: Representing non-linear reaction term in matrix form (homework 5)

by Ramses van Zon -
Yes, this is the idea, however, the minus sign you added in the non-linear term should not be there.
In reply to Ramses van Zon

Re: Representing non-linear reaction term in matrix form (homework 5)

by Christian DiMaria -

Screenshot%202025-03-05%20at%2011.33.44%20AM.png

Thanks, not sure how I missed that extra minus sign. I'm still a bit unsure how to handle the quadratic term though. The first term on the right hand side will be the same as what we had in class with the G matrix so I can calculate that with a triple-loop or BLAS routine. And I think can add the delta_t*u_s term to the result of the matrix-vector multiplication during my time-stepping since it's just a vector of length j. But if I interpret u^2 as a dot product then delta_t*u^2 will be a scalar, so I can't subtract that from a vector. I feel like I am missing something obvious here.

In reply to Christian DiMaria

Re: Representing non-linear reaction term in matrix form (homework 5)

by Ramses van Zon -
There is no 'linear algebra' way to do the non-linear term. You'll have to write a loop and add it element-by-element.
In reply to Ramses van Zon

Re: Representing non-linear reaction term in matrix form (homework 5)

by Christian DiMaria -
That makes a lot more sense, thanks for the help.