JuliaLang / www.julialang.org

Julia Project website
https://julialang.org
Other
361 stars 444 forks source link

Recently released book using Julia #1645

Closed kylenovak29 closed 2 years ago

kylenovak29 commented 2 years ago

Kyle A. Novak, Numerical Methods for Scientific Computing: The Definitive Manual for Math Geeks, 2nd Edition. Equal Share Press, March 2022. The book is also available for free as a PDF from equalsharepress.com.

ViralBShah commented 2 years ago

Would be great if you could edit this page: https://github.com/JuliaLang/www.julialang.org/blob/main/learning/books.md

ViralBShah commented 2 years ago

@kylenovak29 You have a really interesting background. Thanks for putting this book together. I enjoyed flipping through it!

I did notice that you are using LightGraphs for some of your examples, and that package has been updated to Graphs. Not sure if your book is a live book and can be updated - or if it may be something to be addressed in a second edition.

kylenovak29 commented 2 years ago

Added. Thanks.

kylenovak29 commented 2 years ago

Thanks for the feedback! Yes, I can update it. I'm using an agile publishing methodology to make the book available with minimal errors and improve it with feedback. The book is live and it can be updated (both the PDF and the print edition). I should be able to make the changes to the book to use Graphs instead of LightGraphs within the next few days. If you happen across any other errors/suggestions at any time, let me know. Contact information is in the edition page of the book.

ViralBShah commented 2 years ago

@ChrisRackauckas @YingboMa - @kylenovak29 's book also has a nice chapter on ODEs with a nice comparison table. Since we have a line with the author - I thought I would ping you if you wanted to take a quick look and make suggestions, if any.

kylenovak29 commented 2 years ago

Many thanks to @ChrisRackauckas, who has already provided some helpful comments on correcting/improving the comparison table (which has since been updated). Any additional feedback is welcome.

YingboMa commented 2 years ago

Thanks a lot for writing the book! I really enjoyed reading it.

image

BTW, IDA, ode15i, and BDF are all BDF not NDF. We also have the the pure Julia implementation DFBDF which is mathematically equivalent with ode15i. QNDF is the equivalent of ode15s, and both of them are NDF.

Also, Rosenbrock23 and ode23s are both order 2.

ChrisRackauckas commented 2 years ago

I would simplify that down to:

BDF/NDF Julia: CVODE/FBDF/QNDF MATLAB: ode15s Python: BDF

BDF (DAE) Julia: IDA/DFBDF MATLAB: ode15i Python: ------

ChrisRackauckas commented 2 years ago

And for reference https://www.reddit.com/r/Julia/comments/tenqrz/book_numerical_methods_for_scientific_computing/i0qt7nv/?utm_source=reddit&utm_medium=web2x&context=3

YingboMa commented 2 years ago

There's no NDF solver for fully implicit DAEs in MATLAB, Julia, or Python.

ChrisRackauckas commented 2 years ago

Yeah that was just a typo

ChrisRackauckas commented 2 years ago

In fact, even mentioning NDF is probably not a good idea for this book. NDF is such a weird obscure thing. Maybe just

BDF Julia: CVODE/FBDF/QNDF MATLAB: ode15s Python: BDF

BDF (DAE) Julia: IDA/DFBDF MATLAB: ode15i Python: ------

Is good enough.

kylenovak29 commented 2 years ago

Thanks! I'll add Chris' latest suggestion to the table---it looks like it will all still fit. My hope for the table is primarily a summary of the methods discussed earlier in the chapter and secondly as a quick comparison reference. I don't discuss NDFs or Klopfenstein--Shampine except in passing reference to the table, included for completeness as a hold-over from an earlier edition that focused on Matlab. It's too nuanced and dropping mention of it improves readability. Differentiating BDF with DAE will also fit in well when I add the section on DAEs. Also, thanks for catching the order of Rosenbrock23.

kylenovak29 commented 2 years ago

I've updated the table and the section on ODE solvers. To keep the table as simple as possible, I decided to list only pure Julia routines under the Julia column because the other routines in the table could already be used in Julia using a wrapper. I also decided to change the last column to efficiency instead of accuracy because accuracy is arbitrary using adaptive step sizes. I used the benchmarking tools in DiffEqDevTools.jl on two standard stiff/non-stiff problems to roughly categorize the routines by efficiency. Of course, the choice of problems is still arbitrary. I think the table now provides a fairly accurate summary of the methods common across Julia, Python, and Matlab.

odetable odebench
ChrisRackauckas commented 2 years ago

VCABM is a Adams-Bashforth-Moulton, same as LSODE and CVODE with Adams coefficients, which is the same as ode113. So those rows should be merged. CVODE also does BDF coefficients (as does LSODE) for stiff equations: they just swap which coefficients they use (and linear solver).

kylenovak29 commented 2 years ago

I thought that ode113 was an ABM PECE method (using PECE functional iteration) while LSODE and CVODE were AM methods (with Newton or functional iteration) [or BDF methods (depending on the flag)]. I separated them because the LSODE and CVODE can take/compute Jacobians while ode113 does not. The documentation on VCABM says it uses DDEABM (which doesn't appear to use any type of Newton iteration), so I grouped it with ode113. Should I instead group VCABM with LSODE/CVODE? Or do you think all the methods are similar enough that nuance isn't warranted in the table?

ChrisRackauckas commented 2 years ago

Ehh I wouldn't make a difference there. LSODE and CVODE are ABM methods. They solve a nonlinear system and use Adams-Bashforth for the predictor. Then they default to using functional iteration, which if it only did one step of it you'd call that ABM PECE, while it can now iterate that to convergence (or you can set the max to one). You can only give it a Jacobian and force it to do Newton, but effectively no one uses the Adams method like that because it increases the cost but still isn't good for stiff equations (the BDF coefficients are necessary for that), so it's almost used as an ABM PECE method. So in the end, while a few are a bit more flexible, the flexibility is somewhat meaningless and I would just clump the four together as effectively the same non-stiff ODE solver. There are more differences in the stiff ODE case, but the non-stiff algorithms are almost the same.

kylenovak29 commented 2 years ago

Okay. Thanks. I grouped the ABM methods together as well as the BDF methods.

odetable2