Linked Questions

0
votes
0answers
30 views

Keeping memory to reduce the running time of recursion [duplicate]

I am using the following recursion in Mathematica to compute W[n, 1, s] for given n and s: ...
76
votes
7answers
4k views

Can one identify the design patterns of Mathematica?

... or are they unnecessary in such a high-level language? I've been thinking about programming style, coding standards and the like quite a bit lately, the result of my current work on a mixed ...
16
votes
3answers
1k views

Why does Mathematica use [[ ]] notation for array indexing?

I am confused by why Mathematica uses [[3]] to get the 3rd element, or [[i,j] to get the i,j-th element of a 2D array. This ...
5
votes
3answers
717 views

recursive integration

I am trying to do multiple integrations recursively. For instance, I would like to do the following equation for arbitrary integer $n$: $\displaystyle R_n(t) = \int_0^t \mathrm dt' R_0(t-t') ...
7
votes
2answers
2k views

Series of piecewise functions

Let $f_{0}(x):[0,1]\to[0,1]$ be defined by $$f_{0}(x):=\begin{cases} 3x, & \text{if } x\in [0,\frac{1}{3}] \\ \\ -3x+2, & \text{if } x\in (\frac{1}{3}, \frac{2}{3}] \\ \\ 3x+2, & ...
6
votes
2answers
643 views

Why does Expand not work within a function?

I'm writing this fairly simple function: ...
4
votes
3answers
299 views

How to generate a recurrent sequence

How to generate this type of sequence? $$ f(n, x) = x f'(n-1, x) \hspace{2 mm}, f(0, x) = e^x$$ How do I evaluate it for numerical values for $x = 1$ or any number?
10
votes
2answers
453 views

Dynamic Programming with delayed evaluation

By using dynamical programming, we can save intermediate steps for recursive relations, as in f[n_]:= f[n] = f[n-1] + f[n-2] However, this only stores ...
9
votes
1answer
645 views

Compiling a recursive formula

My question is related to computing what is called "invariant measure" for a particular well known fractal - the Sierpinski triangle. We have an array m of four two by two matrices, say ...
1
vote
3answers
263 views

List of Tribonacci Polynomials with Mathematica? [duplicate]

I want to list top ten of Tribonacci polynomials. I have following algorithm, but it doesnt work. ...
0
votes
1answer
309 views

Tabulating Numeric Approximation

I was wondering how to approximate or tabulate values for this numeric approximation: It is the following: The confusing part is how to implement the subscripts in mathematica. $y_{i+1} = (t_i - ...
7
votes
2answers
96 views

using memoization with conditional statement

I would like some advice about the use of memoization in conjunction with conditional statements. Let me try to explain my problem: I am constructing a function depending on a number of parameters. ...
16
votes
0answers
636 views

Fast Spherical Harmonics radiative transfer

This is a rather specific question and I apologize for spamming you with some lengthy code. But it could be interesting for some reader and maybe you can help out, so please bear with me. I am using ...