409 views

### Slow computation of recursive sequences

I want to investigate the asymptotic behavior of the following recursive system: ...
88 views

### a recursive function using memoization

I have looked at a lot of these cases, e.g. Can one identify the design patterns of Mathematica? and the included ones. My trimmed example, here establishing the 'initial conditions' (where the ...
102 views

I want to step-monitor at each time step of a spatio-temporal NDSolve (using the finite element method) the maximum bending of the function sampled over the curent mesh. For this I first need access ...
34 views

### Is there a difference between these two ways to define a function? [duplicate]

(I took this example from another question) f = 0; f[n_] := f[n] = DigitCount[n, 10, 1] + f[n - 1]; f I notice that this example defines f(n) in a ...
451 views

### Remove element from list and store it in variable?

In many programming languages there are functions that remove an element from a set while giving back that element. E.g. I'd like to have a function FetchFromStack ...
194 views

### how to make program read from top-to-bottom? [closed]

"As a general principle, make the program read from top to bottom rather than jumping around. Experts agree that top-to-bottom order contributes most to readability." I think it's difficult to do it ...
144 views

### Trace of -{1} expression

I'm trying to understand Trace. Usually it doesn't repeat but it adds {-1,-1} for his simple expression after having a correct ...
402 views

### Recursive Function Numerical Integration

I just tried to modify a code snippet for Neumann series to the Fredholm integral equation $f(x)= \sqrt{x} - \int^1_0 dy\; f(y) \sqrt{x y}$ which I read in another post: How to solve an integral ...
373 views

### Time constrained optimization?

I'm trying to solve a maximization problem that apparently is too complicated (it's a convex function) and NMaximize just runs endlessly. I'd like to have an approximate result, though. How can I ...
127 views

### How to efficiently manage lists of arbitrary length?

I am running calculations that will generate a list of lists of integers. Throughout the calculations, the number of lists will increase, and already-existing lists will be added to. What is the ...
315 views

### How to avoid repetitive calculation when doing numerical integral?

Suppose I have a function f[x] which is very complicated, together with a function g[f[x]]+h[x] to integrate. That is: ...
186 views

### Improve recursive function (memoization)

These days I am trying to rewrite the following recursive function, in order to gain some speed. It is crucial because I end up using 4-5 similar functions, and I need to decrease execution time. ...
2k views

### Granular versus terse coding

While reading Leonid's grand answers to General strategies to write big code in Mathematica? I came across something that goes against my own practices. I do not disagree with the principle but the ...