All Questions
Tagged with recursion functional-style
15
questions
2
votes
1
answer
46
views
Results of recursion grouped in list [closed]
I made a recursion where I should plot resulting points. When I do Print[point1], it just gives me result:
...
0
votes
1
answer
53
views
Constructing sequence of function with elements depending on the previous one / recursion
Starting from a function $\theta0[x\_ , y\_ , z\_ ]$, the terms $\varphi[x\_ , y\_ , z\_ ]$ constitutes a sequence of functions that is constructed as follows:
Order 1 (one function and its ...
1
vote
1
answer
121
views
Priority of nested function in Mathematica
I am facing a small problem with the nested function in Mathematica. Please take a look at the attached Code below.
...
1
vote
5
answers
203
views
Recursive "InverseFactorial" Function
I am attempting to write a general function that can take any number and back calculate to see if it is the factorial of a smaller number. The easiest and quickest way to do this is to take the ...
4
votes
1
answer
193
views
Fast way to compute a truncated series using Fold
I'm looking at an efficient and fast way to compute the results of a finite summation
$$\sum_{i=0}^Mf_ig_i\,. $$
I noticed that simply applying
...
3
votes
0
answers
576
views
Epsilon algorithm to accelerate sum's convergence in a functional approach
I am trying to learn to use Mathematica in an efficient way. Thus, I decided to spend some time on functional programming. I would like to implement the so-called epsilon algorithm, that is used to ...
7
votes
3
answers
372
views
4
votes
1
answer
385
views
How to use currying to write a tail recursive function for summing factorials given a certain bound
I am very confused about how can i use currying to write a tail recursive function for summing factorials within a certain bound or summing the bounds i.e. given [1,5] i should be getting 1!+2!+3!+4!+...
14
votes
3
answers
700
views
Mimic a procedural, recursive clustering algorithm for site percolation using functional programming
Sorry in advance for my logorrhea: I just want to make sure all of the information is here.
Context and Question
I am investigating site percolation on a square lattice. I have a working, depth-...
0
votes
1
answer
127
views
How to improve this function that selects parameters from arbitrary distribution using Recursion?
Below, I have defined a function using Which to select model parameters based upon various conditions. My questions are: Is there any danger in writing this function using Recursion?
Is there a more ...
2
votes
2
answers
895
views
Summing Over a Variable Number of Indices
I am trying to figure out the best way to include a variable number of indexes of summation in a program.
For example: Suppose I want to define a function $g[n,s]$ that returns the sum $$\sum_{a_1+.....
6
votes
1
answer
342
views
What is the most elegant way to specifiy a start case for recursion?
When writing recursive code that computes the least value at which a condition is true and various other scenarios it is often necessary to specify a base case. What I have done to supply this is ...
1
vote
1
answer
127
views
Defining a formal Primitive Recursion
I'm searching for a way to define the function this wikipedia article call Primitive Recursion. It should have two functions as argument and it should return a function. I need this as helping in ...
8
votes
2
answers
735
views
Update a function avoiding infinite recursion
I am quite new to Mathematica and not completely familiar with functional programming. I am currently working with a function (call it foo) and wish to change its behaviour, for example, by adding 1 ...
6
votes
5
answers
404
views
How to nest my own "times" function to get powers
I have a "times" function. I'd like to create a power function using it. It should look like this for an 6th power:
...