Questions tagged [difference-equations]

Tag for the usage of RSolve, RecurrenceTable, DifferenceRoot, and other functions related to difference equations.

Filter by
Sorted by
Tagged with
33 votes
1 answer
2k views

Has this implementation of FDM touched the speed limit of Mathematica?

Still, I'll use the implementation of the 1D FDTD method (you can simply understand it as a kind of explicit finite difference scheme for the Maxwell's equation) as the example. Just for completeness, ...
user avatar
  • 54.1k
10 votes
1 answer
9k views

Bifurcation Diagram for 1D Map

Continuing with the same question I have posted earlier I would like to find the equation of the stable fixed point curve using my graph, i.e. from the curve somehow find the equation for $x=f(x)$. I ...
user avatar
16 votes
2 answers
2k views

Finite difference method not converging to correct steady state or conserving area?

I am working with the following PDE, which is an advection-diffusion type equation. It describes the movement of a fluid-fluid interface inside an annulus of inner radius $R_1$ and outer $R_2$ under ...
user avatar
  • 723
6 votes
1 answer
2k views

Discrete-time Lyapunov exponent plot

I am trying to create a Lyapunov exponent plot as a function of $\alpha$ for two functions: $$ f(x) = (\alpha + 1)x - \alpha x^{3} $$ and a piecewise function given by following Mathematica code: <...
user avatar
2 votes
1 answer
264 views

Using NIntegrate in Finite Difference Derivative method

I'm trying to solve a second order differential equation using the code given by @xzczd here which is based on this. What this ...
user avatar
  • 369
1 vote
1 answer
751 views

Can I simplify (solve) a certain DifferenceRoot expression?

I've generated this expression ...
user avatar
8 votes
1 answer
1k views

Poisson PDE over a irregular region with FDM

The problem modeled by the Poisson PDE is related to the torsion of prismatic beams and I use the Finite Differences Method (FDM). I've managed to solve the equation over a rectangle region with ...
user avatar
  • 283
4 votes
2 answers
944 views

Show Factorial instead of Gamma in the result of RSolve

Now I wanted to solve for a recurring function with RSolve. Here's how I tried: ...
user avatar
  • 175
5 votes
5 answers
445 views

Can I generate a "piecewise" list from a list in a fast and elegant way?

Suppose we have a number list a: n = 1000000; a = RandomReal[{0, 1}, {n}]; We want to generate a list ...
user avatar
  • 54.1k
2 votes
0 answers
48 views

RecurrenceTable doesn't evaluate with constant right-hand side

One of my functions automatically generates systems for RecurrenceTable. Usually works fine, but today I encountered a problem. If the right-hand side is a ...
user avatar
  • 18k
8 votes
4 answers
205 views

Implementing delay in NestList?

The traditional iterated map can be implemented with NestList, such as the Logistic Map, x[n+1]=rxn, can be implemented with the single line: ...
user avatar
  • 623
4 votes
3 answers
3k views

Nonlinear recurrence relation

I entered the following recurrence relation into RSolve and it just gave the question back to me. $$a_{n+1} = \frac{(1+a_n +(a_{n−1})^3)} 3$$ Is there another way ...
user avatar
  • 141
3 votes
2 answers
2k views

RecurrenceTable with a recurrence function of two variables

I have to calculate the cool down process of a regenerative heat exchanger. I solved the problem in Excel before, but now I want to do it with Mathematica. I want to create a table with the variables ...
user avatar
  • 33
2 votes
2 answers
459 views

Why does Mathematica not evaluate the difference recurrence using `RSolve` or `RecurrenceTable`?

Mathematica does not evaluate the following recurrence of two variables using RSolve and only echoes the input: ...
user avatar
  • 808
1 vote
2 answers
341 views

Bifurcation diagram of a difference equation

The function is f[x_, a_] := Piecewise[{{x (1 + a - a*x), x <= 1/2}, {x (1 - a + a*x), x > 1/2}}] How to make the bifurcation graphic of it? What ...
user avatar
0 votes
1 answer
259 views

Explicit, closed formula for recursive integral as a function of the recursive parameter

This is a follow-up of this question/answer. I'm working on a recursive integral more complicated than the one on the linked question, but this one can be used as an example. I would like to obtain ...
user avatar
  • 101
13 votes
3 answers
484 views

Archimedes' Scheme to find $\pi$

Given an Archimedes' scheme $$a_{n+1}=\frac{2a_nb_n}{a_n+b_n}$$ $$b_{n+1}=\sqrt{a_{n+1}b_n}$$ with initial values $a_0=2\sqrt{3},b_0=3.$ How do I prove using Mathematica that this converges to $\...
user avatar
7 votes
1 answer
158 views

Are there different Method options that can be used with FindSequenceFunction?

The help page states that Method is an option to use with FindSequenceFunction, but I don't find any further information. (There ...
user avatar
6 votes
2 answers
376 views

Periodic Orbits of the MacKay Map

For the MacKay (Henon action-angle transformation) Map (Mackay 1983): $x_{n+1}=q-\alpha x_n-x_n^2-y_n \\ y_{n+1}=x_n$ with $q, \alpha \in \mathbb{R}$ real parameters I would like to calculate the ...
user avatar
  • 707
6 votes
1 answer
212 views

Random Variable in Recurrence Function

Following the previously published question, I'm looking for the solution of RecurrenceTable with explicit random variable. For example, something like ...
user avatar
7 votes
2 answers
455 views

Find a stable 3-cycle of the sine map

I am trying to find an stable 3-cycle for the sine map $g(x) = a \sin(\pi x)$ but I do not know exactly how to use mathematica to do so. Is there anyone familiar with this? $x$ lies as before ...
user avatar
1 vote
0 answers
621 views

How to derive finite-difference scheme automatically on a quite general stencil

Info This question is a generalization of the following one Derivation of numerical scheme for linear transport equation on a variable stencil. Statement of a problem Linear scalar hyperbolic (...
user avatar
13 votes
2 answers
417 views

RecurrenceTable iteration variable not localized? Bug or user error?

I recently lost a lot of time on this and need to understand whether I have misunderstood MMA operations or there's a problem. I am using MMA 10.1 on Windows 7 64-bit. The essence of the issue is ...
user avatar
  • 2,410
8 votes
1 answer
128 views

Weird RecurrenceTable bug

Bug introduced in 10.0 or earlier and persisting through 12.2 or later The output of RecurrenceTable seems to lose a level when there are more than 250 points and ...
user avatar
  • 18k
4 votes
2 answers
321 views

RSolve not reducing for a certain recurrence relation

I'm trying to use RSolve as follows to solve a recurrence relation: ...
user avatar
  • 143
3 votes
2 answers
643 views

How to simplify output of Series?

The command Series[Sum[Sum[1/(a*b), {b, a, 3 a}], {a, 1, N/Sqrt[3]}, Assumptions -> N > 0], {N, Infinity, 1}] produces a somewhat complicated answer <...
user avatar
  • 17.6k
0 votes
1 answer
80 views

RSolve two variables with multiple boundary conditions

In short, I want to solve a recurrence equation in two variables with multiple boundary conditions. In more detail: For instance, suppose I want to compute $a[0,j]= 1 \quad \forall j$ $a[i,0]= 1 \quad ...
user avatar
  • 251
0 votes
1 answer
194 views

periodic point of a quadratic map

I am analyzing a discrete dynamic quadratic map. The bifurcation diagram shows the existence of an asymptotic 3- cycle periodic point for a given parameter. But the graphic of the lyapunov exponent ...
user avatar
  • 1
7 votes
3 answers
557 views

How do I recursively calculate this equation and generate a list of iteration?

How do I write a recursive equation to compute a list of answers? I tried NestList, but it didn't work. ...
user avatar
  • 247
7 votes
1 answer
613 views

How to find a recurrence relation for a sequence?

I have a sequence given by an explicit formula for n-th term: ...
user avatar
4 votes
1 answer
435 views

Finding Hofstadter's Q-Sequence very slow

I'm trying to find Hofstadter's Q-Sequence. I tried: RSolve[{Q[n] == Q[n - Q[n - 1]] + Q[n - Q[n - 2]], Q[1] == 1, Q[2] == 1}, Q[n], n] but it doesn't work. ...
user avatar
  • 8,638
4 votes
1 answer
323 views

How to approximate the solution of a system of quartic equations

In an attempt to evaluate the point at which the cycle 2 becomes unstable for the given map: \begin{equation} x_{n+1}=μ-x_n^4=f(x_n), \quad μ \in \mathbb{R} \end{equation} I have so far managed to ...
user avatar
  • 707
3 votes
1 answer
339 views

Find RSolve solution reflecting special structure of DifferenceRoot[Function[{\[FormalY], \[FormalN]}

RSolve yields a large (multi-page) solution (LeafCount=25891) containing a number of 7F6 (and higher) hypergeometric functions when applied to ...
user avatar
3 votes
1 answer
115 views

How to replace the symbol n in DifferenceRoot

I'd like to employ another symbol (say alpha or k) instead of n in the following (type of) ...
user avatar
3 votes
1 answer
374 views

Finite Difference - heat generation in a square (square within a square)

I am trying to develop a code that will allow me to solve the following problem. Lets say that I have a square block, inside that square block I have a smaller square box thats at a certain ...
user avatar
3 votes
3 answers
612 views

Problem plotting a bifurcation diagram of logistic map

I would like to plot a bifurcation diagram from the logistic map (difference equation) of the type $$ x_{t+1} = r\,(1-x_{t})\,x_{t}. $$ The code I used for that was ...
user avatar
  • 1,120
2 votes
2 answers
437 views

How can I express this recurrence function in Mathematica?

\begin{equation} r_{i+1}=r_{i}+V_{i}{\Delta}t \end{equation} Where \begin{equation} V_{i}=(0.01, 0.40) \end{equation} and ${\Delta}t$ is the difference in time. My implementation (this is for ${\...
user avatar
2 votes
3 answers
189 views

Computing a sequence by recurrence

I am trying to create a list where each element of the list is calculated using the sum of all previous elements of the list and also uses the $N$th element of another list. The initial value of the ...
user avatar
  • 37
2 votes
1 answer
95 views

Finding a function/differential equation from a 2nd order recurrence relation

Consider the following 2nd order recurrence relation: $$A_{1}=1,\; A_{2}=z$$ $$A_{n+2}(z)=(b_n+z)A_{n+1}(z)+a_nA_{n}(z),\; n=1,2,3,...$$ where, $$b_n=n\left(n+m+\frac{1}{2}\right),\; a_n=k^2n\left(...
user avatar
  • 1,504
1 vote
1 answer
138 views

Computing a Sequence using Recurrence

I posted a similar question earlier today, but unfortunately I realized after several hours that I over-simplified the problem for this forum. There is a very good answer to the Computing a sequence ...
user avatar
  • 37
1 vote
2 answers
317 views

Chebyshev polynomials

How could I write the Chebyshev polynomial as a function that uses Nest? Also, how could I write it using recursion? Furthermore, how can I show that $T_n(x)=\...
user avatar
1 vote
2 answers
448 views

Solving matrix equation

How can I solve the forward equation S[t]=C+A*S[t+1]*(Inverse((I-B*S(t+1)))*A for t=1 to t=10 and ...
user avatar
1 vote
0 answers
82 views

Zeros of a rational fraction sequence

This is a follow-up of the question Finding a function/differential equation from a 2nd order recurrence relation, I asked yesterday. The reason why I didn't edit the original question was that in ...
user avatar
  • 1,504
1 vote
0 answers
47 views

RSolve not evaluating when given my system of recurrence equations

I am trying to solve the following system of recurrences with RSolve: ...
user avatar
1 vote
0 answers
47 views

General question about RSolveValue and general programming

If I have the following code: ...
user avatar
  • 421
1 vote
2 answers
454 views

Random variates in Recurrence Function

I'm completely new to Mathematica and can't seem to find an answer elsewhere so hopefully I can get some help here. I'm trying to plot a recurrence relation, where a random variate is generated at ...
user avatar
  • 11