Forum Discussion
Access Analytic Power Query challenge: Ticket list
re: Side note.
I, too, user recursion very rarely. I believe the time it comes into its own is when one has a termination criterion but little knowledge of how many steps will be required to satisfy the condition. Examples might include minimising a non-linear objective function or integrating ordinary differential equations using a variable step length method. Things I might try one day, but have yet to tackle. I think lori_m may have a more informed opinion as well as some examples.
Yes, as per Peter's comment, one can distinguish two types of lambda definition:
Standard (non-recursive): function applied a given number of times
e.g. data transformations (e.g. this one), multi-dimensional arrays, linear optimisation
Recursive: function applied repeatedly until a condition is met
e.g. search problems, numerical solvers, non-linear optimisation, even machine learning
While many of the recursive examples might be considered a stretch to accomplish using formulas alone, it only takes for a lambda to be made available by someone in order for anyone else to apply it (e.g. Sudoku attachment). A good learning exercise for me was to write a recursive lambda to find the IRR of a list of values using either bisection or Newton-Raphson methods, and then check against the built-in function.
- PeterBartholomew1Nov 27, 2022Silver ContributorThat is a pretty amazing formula. Even the formula to calculate the possible values for a given cell is elegant. I separated that formula out and the concatenated the values to help a manual solution.
I still find recursive formula intensely difficult to set up and test and this one has the two recursive loops to contend with!- lori_mNov 28, 2022Iron Contributor
I didn't come up with the method of solution. The formula is a pretty direct translation of the linked python code originally from R. I also wondered about applying similar logic to chess puzzles: eight queens, knight's tour, even a simple chess playing program. Hoping someone will rise to the challenge!