Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Julia

You're reading from   Learning Julia Build high-performance applications for scientific computing

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781785883279
Length 316 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Rahul Lakhanpal Rahul Lakhanpal
Author Profile Icon Rahul Lakhanpal
Rahul Lakhanpal
Anshul Joshi Anshul Joshi
Author Profile Icon Anshul Joshi
Anshul Joshi
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Understanding Julia's Ecosystem FREE CHAPTER 2. Programming Concepts with Julia 3. Functions in Julia 4. Understanding Types and Dispatch 5. Working with Control Flow 6. Interoperability and Metaprogramming 7. Numerical and Scientific Computation with Julia 8. Data Visualization and Graphics 9. Connecting with Databases 10. Julia’s Internals

Recursion


Recursion is a technique in computer science that allows for a bigger problem to be broken down into smaller similar sub-problems that makes it easier to solve and debug.

Speaking about functions, we call a function recursive if it makes repeated calls to itself. This would typically involve the function having a base condition and being small enough to magnify itself easily enough to solve the overall problem.

Julia functions can also make recursive calls, just like any other language. Let's take the case of the Fibonacci series, wherein every number in the sequence is the sum of the previous two:

# fibonacci series
1,1,2,3,5,8,13....

So, if you look closely, the number 2 is the sum of its previous two digits 1+1, and then the next number, 3, is the sum of its previous two, 1+2, and so on. This problem makes a genuine case of recursion.

WHY? Simply because each and every step involves the usage of the same logic being applied, thus the overall sequence can be said to have been created...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image