Questions tagged [sequence]

Questions on specifying order in and splicing of lists, including use of Mathematica Sequence objects.

Filter by
Sorted by
Tagged with
1
vote
1answer
63 views

How can I get an element of a sequence?

How can I get an element of a sequence? For example Sequence[a,b,c,d] How can get c?
1
vote
0answers
59 views

Alternatives not working with Sequence[]?

In the following piece of code I've specified two possibilities to match via Alternatives, but only one of them seems to be considered: ...
1
vote
2answers
74 views

Recursive sequence with RecurenceTable

I want to compute elements of a recursive sequence and use them as coefficients of a power series. However, the (i+1)-th element depends on all previous elements. Writing this as a sum in ...
1
vote
1answer
37 views

Using For to generate a sequence

I want to find the smallest positive integer $k$ such that the finite list s[k*m] contains no odd numbers, for $m=1,2 \dots$. Unfortunately ...
2
votes
2answers
79 views

Use Mathematica to split a sequence according to other two sequences

I want to use Mathematica to solve the following problem: For example I have a sequence 101. I want to compare it with $1101$ and $0101$. The comparison has the following procedure: Check the first ...
0
votes
0answers
43 views

How to use a DifferenceRoot?

I am trying to find the coefficients of a sequence given by the recurrence relation: -2 a A g[a - 1] + 2 (n - a) B g[a + 1] + (n -2 a) C g[a] == 0 where A, B and ...
1
vote
0answers
57 views

Avoiding the memory requirements of an accumulation of returned Nulls (etc)

There is an extensive but relatively old answer to a similar question here, and there are many Qs and As about avoiding using Table where possible. My problem is a mixture of the two: I have been ...
3
votes
2answers
106 views

Generate a sequence of sequences

Imagine I have a sequence of M integers each of which is either zero or one. How do I generate a sequence of all such 2^M sequences?
1
vote
2answers
123 views

How to use a general method to solve this problem

Suppose $a_{n}>0(n=1,2,\cdots)$. The series $ \sum_{n=1}^{\infty} a_{n}$ converges and the constant $ \lambda \in\left(0, \frac{\pi}{2}\right)$. Now I need to judge whether the series $\sum_{n=1}^{\...
2
votes
2answers
166 views

How to judge whether the series is absolutely convergent?

I need to judge whether the series $\sum_{n=1}^{\infty}(-1)^{n}\left(1-\cos \frac{\alpha}{n}\right)$ (α>0) is absolutely convergent. ...
0
votes
3answers
89 views

How to find the limit of this recursive sequence

I want to find the limit of the following recursive sequence when n tends to : ...
4
votes
1answer
249 views

What does Sequence[2,4]^2 mean?

I am learning pattern matching. An example that confuse me is as follows. Foo[x__?EvenQ] := x^2; Foo[2, 4] which is equal to ...
5
votes
1answer
80 views

head of a sequence

Why does Head[Sequence[b, c]] return c[Symbol] and not Sequence? Why does ...
2
votes
1answer
46 views

Splice matching function arguments

Mathematica 12.1 introduces Splice that replaces the old way of using Sequence@@ to "melt" a list of entries. However, the ...
0
votes
0answers
30 views

Pattern matching on derivatives

I want to manipulate and do pattern matching on sequences of functions and their derivatives, but I'm struggling to work with the multiple indexing required. Here is an example. Let $$ y(z) = \sum_{j=...
1
vote
0answers
38 views

Apply SequenceReplace with a fixed shift

How can I apply SequenceReplace with a fixed prespecified shift instead of a shift equal to the length of the pattern, on a given list? E.g. ...
6
votes
2answers
247 views

Build general form of an infinite sequence

Please, I would like to build the general form of an infinite number sequence $$\dfrac{8}{35}, \dfrac{5}{21} ,\dfrac{8}{33} ,\dfrac{35}{143},\dfrac{16}{65} ,\dfrac{21}{85} ,\dfrac{80}{323},\...
0
votes
1answer
39 views

Plot any parametrization (pure function, numbered variables)

I'd like to write a function plot[reg_,f_] that takes as input any product of intervals (list of pairs of reals) reg$\subseteq\!\...
2
votes
0answers
61 views

FindSequenceFunction instantly throws an exception

FindSequenceFunction[{2, 4, 6, 7, 14, 29, 18, 5, 5, 2, 4}] SystemException["MemoryAllocationFailure"] $Version "12.0.0 ...
6
votes
0answers
153 views

How can I prevent errors with ReplicateLayer[]?

I am trying to build a NetGraph[] that takes input of the form {{0.6},{0.6},...,{0.8},{0.8}} and multiplies the last sequence ...
2
votes
2answers
71 views

Select subsets from a list based on a criterion?

Assume we have a set of numbers, for instance $A=\{2,3,4,5,6,7,8,9,10\}$ and we are looking for the sums of reciprocals such that they are less than one. I mean I am looking for all $S_B$'s $$ S_B=\...
12
votes
2answers
209 views

The use of SlotSequence in If[#1 > #2, ##] &

The below function when applied to a list of two elements, will output the maximum between the two: If[#1 > #2, ##] & For example: ...
4
votes
3answers
444 views

Slow computation of recursive sequences

I want to investigate the asymptotic behavior of the following recursive system: ...
0
votes
0answers
68 views

How to convert a symbolic recursive formula to a non-recursive one

I am new to Mathematica. I want to convert a recursive formula to a non-recursive one using symbolic math. Specifically, I have a recursive formula similar to this: $a_n = f_a(c_{n-1}, x_{n-1})$ $...
1
vote
0answers
74 views

Is there a way to predict permutations that consist of sets?

SequencePredict is a function that predicts the next value from the arranged data. But I want to use the data for the combination to predict the next combination(...
1
vote
2answers
91 views

Short Normal Numbers in base 10

Normal numbers in base 10 are those for which, in the base 10 decimal expansion, you can find every natural number. Champernowne's number is a very simple example of this where it is simply written as:...
5
votes
2answers
382 views

Turning arguments into exponents

I'd like to replace every instance of L[stuff], e.g., L[-1,-2,-2] in an expression with ...
2
votes
1answer
52 views

SequenceReplace is incorrectly modifying the list when a pattern partially matches

(Below is a big simplification of my actual use-case which reproduces the problem with SequenceReplace. Please assume my use of ...
0
votes
0answers
75 views

Is there an integral number `k` satisfying the equation `a[n] = k^2`?

I have a sequence a[n] with $$a(n+1)=4 a(n)-2 a(n-1),\quad a(0) = 1,\ a(1) = 28.$$ I use ...
3
votes
5answers
124 views

How to rearrange the terms in polynomials to the power of x?

Here is my code Eliminate[y == x + n && x^2/6 + y^2/3 == 1, y] I got 6 - 3 x^2 == 2 n^2 + 4 n x But I wanna it to be ...
1
vote
2answers
93 views

Computing recursive sequence [duplicate]

I would like to compute a[1000] of the following recursive sequence a[1] = 1; a[n_] := a[n - 1] + 1/a[n - 1]^2 but it takes a long time for computing even small ...
3
votes
1answer
65 views

FindGeneratingFunction gives up too easily [closed]

I am trying to automatically find a generating function from the coefficients of a simple rational function using Mathematica's FindGeneratingFunction: ...
0
votes
1answer
89 views

Finding a sequence with RecurrenceTable

I would appreciate if somebody could help me with the following problem: Q: How can the following recursion equations be solved using RecurrenceTable? $\...
1
vote
2answers
295 views

How to define a recursive sequence

I would appreciate if somebody could help me with the following problem: Q: How to define this in Mathematica. $$a_{n+1}=\begin{cases} a_{n} & ,a_{n} \ge n\\ 2n-a_{n}& ,a_n<n \end{cases}...
4
votes
3answers
435 views

Generate this sequence more efficiently

Is there a more effecient way to generate the sequence shown below. ...
5
votes
1answer
76 views

How to set up patterns when using SequenceSplit

Given a list lst={0,0,0,0,0,"A1",0,0,0,"B2",0,0,"C3","D4","E5",0,0,0,"F6"} How to split it as ...
0
votes
1answer
134 views

Convert a piecewise definition of a single impulse into an impulse train

NOTE: See update at end of question I have a function smoothstep (based on the derivative of a smoothstep function) that gives a single impulse as follows: ...
4
votes
1answer
139 views

Longest Repeated Substring

Is there a solution in Mathematica to the problem of finding the longest substring of a sequence that occurs at least twice.For example {1, 2, 3, 4, 5, 2, 3} has ...
1
vote
1answer
36 views

Splitting a list of letters into subsequences starting with uppercase letters [duplicate]

Given a list of upper/lowercase characters, I'm trying to split it into subsequences that start with an uppercase and contain the next few (not necessarily positive number of) elements up until the ...
2
votes
2answers
65 views

Counting the number of Configurations in an Array with Constraints

Consider an array $$\{a_i\}, i=1, ..., N$$ with periodic boundary condition, i.e. $i\equiv i+N$. $a_i\in \{0, 1\}$. I would like to count the number of configurations of the array $\{a_i\}$ satisfying ...
5
votes
1answer
160 views

How to find the length of an indefinitely repeated sequence in a list

Here, I am not looking for simply a repeated element, but an indefinitely repeated sequence. For example, if I have the list ...
2
votes
1answer
145 views

Generating Manipulate variables from a list of rules

I have the following list of rules: ...
3
votes
2answers
84 views

How to convert the solution of this recurrence like this form?

I am trying to solve the recurrence sequence. I tried RSolve[{a[n] == 1/2 (a[n - 1] + 9/a[n - 1]), a[1] == 1}, a[n], n] // Simplify I got {{a[n] -> 3 Coth[...
-1
votes
2answers
75 views

Please help me get the ratio of x to y [closed]

I need the ratio of x to y in this equation: sum [n*(x/10)^n/10^(n-2)] == y from n=1 to ∞ Thank you!
2
votes
1answer
57 views

Define a variable whose value for each i in [|1,n|] depends on the average value it takes for j different from i [closed]

I would like to define the following variable : So the average value (a) takes for every "individual" but i. But actually, for each i, the value (a) takes depends on the preceding average: ...
3
votes
1answer
144 views

Taking a long time to produce output

In the following, I want to know b[1000], but it is taking a very long time even for b[30]. Please help ...
2
votes
3answers
82 views

Function of a function, both of a list of variables

I am trying to avoid dealing with long explicit lists of variables. What i do so far is the following: VarList={x_, y_}; ParList={x, y}; ValList={2, 3}; What ...
3
votes
4answers
178 views

@ and Sequence ( and /@ ) [duplicate]

list = { {a,b}, {c,d}, {e,g} } How to efficiently get { f[a,b], f[c,d], f[e,g] } I tried various combinations using ...
1
vote
1answer
79 views

Weird Behavior of Table and Sequence

I'm writing a function that constructs a multidimensional array (that is, nested lists) using Table. The dimension of the array varies according to the argument to ...