New Sum of Powers Log Function
|
04-02-2021, 01:18 PM
Post: #22
|
|||
|
|||
RE: New Sum of Powers Log Function
(04-02-2021 01:29 AM)Albert Chan Wrote: Note that guess is evaluated twice. This is a fluke of mpmath, to simplify code. This is the patch to fix this issue. C:\python\Lib\site-packages\mpmath\calculus\optimization.py, findroot(): Right before entering solver, i.e. below comment "use solver" Code: # use solver What is shocking is the patch may save more than 1 call. Example, copied from help(findroot): >>> f = [lambda x1, x2: x1**2 + x2, lambda x1, x2: 5*x1**2 - 3*x1 + 2*x2 - 3] >>> findroot(f, (0, 0)) [-0.618033988749895] [-0.381966011250105] Patched findroot reduced f calls, from 24, down to 17 Code: 01 0.0 0.0 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)