mfig
- 283
- 99
hunt_mat said:Whereabouts are you evaluating r on your first yellow boxed equation?
I get what you're doing and your code looks very nice. When I tried to code before, I got blow up for my code. I essentially did something similar to what you did but I treated the boundary conditions differently.
hunt_mat said:Why wouldn't you think my A matrix wasn't an [itex]N_{r}\times N_{r}[/itex] matrix? The length of a is clearly [itex]N_{r}[/itex] and the command diag(a) makes an [itex]N_{r}\times N_{r}[/itex] matrix?
hunt_mat said:Is this the first version of the code? I posted a second version a few posts up.
mfig said:I didn't see any error in your original code, but I did notice something strange at least to me. Your A matrix is not N-r-by-N_r. Compare how I constructed the M matrix in my code.
I think it was my boundary conditions that were causing the problems and I wanted to make sure that I could code something up that worked, and I think I managed to. I did something reasonable and the code worked nicely and there was nothing blowing up, so I am going to compare the results from my code and yours to see if they get the right thing and if they are then that's good. The next thing to consider is the speed of execution. I'll be calling this routine potentially thousands of times and I want it to be as fast as possible.mfig said:Yes, as I said... I was looking at your original code:
The reason I was looking at your original code is in your reply #34 you mentioned that you had previously tried what I did, but you were dissuaded from using it over some conservation problem. I have not looked into your latest code because the derivation you provided in a .pdf is more complex than the classical C-N method I used, and needlessly so, IMO.
I may get a chance later to take a look, but I have meetings and office hours for the rest of today (Numerical Analysis, BTW)