Questions tagged [sequence]

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

Filter by
Sorted by
Tagged with
33
votes
0answers
836 views

Performance problems in new Sequence functions

The new-in-10.1 Sequence* family of functions should provide newly optimized methods for handling sequence problems. Happily in some cases they do! For example ...
19
votes
2answers
437 views

Using Sequence to delete a part of an expression

I thought that assigning Sequence[] to a part of an expression is an effective way to remove it. For example, the following code yields ...
17
votes
2answers
1k views

What happens when you divide by ##?

I've been playing around with sequences a bit. In particular with using ## with unary and binary operators. Let's start simple, the following all make some kind of ...
15
votes
4answers
623 views

How do I test if a variable represents a sequence?

I created a variable that represents a sequence: mySeq = Sequence[1, 2, 3]; I wanted to use that variable as an argument for some functions. But I got in trouble....
14
votes
4answers
1k views

How can I return a Sequence?

Recently I had the need to redefine a certain symbol in my init.m so it would be automatically omitted from any lists it appears in. I decided to redefine it to an empty sequence, e.g. ...
14
votes
1answer
211 views

Pattern matching with List and Optional

Bug introduced in 8.0.4 or earlier and persists through 11.1.1 Thank you for bringing this to our attention. I have filed a report with our developers. Why does this ...
11
votes
9answers
459 views

Positions of elements in the initial flattened list in a split list

Say, we have a list: m1 = {2, 2, 7, 0, 7, 7, 2, 2, 2} It can be split easily: ...
11
votes
2answers
178 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: ...
11
votes
1answer
321 views

Empty Blank regression in v10.1

Bug introduced in 10.1 and fixed in 10.2.0 In v10.1.0.0 on Linux, when Blank[] is used in Alternatives with pattern that can ...
10
votes
7answers
687 views

Counting subsequences (i.e., patterns) within a list?

I would like to count the number of subsequences in list. Say I have data given by: data = {1, 1, 1, 2, 1, 2, 2, 2, 1, 2, 1}; I would like to count the number ...
10
votes
5answers
512 views

Repeating Digits

I have written ...
10
votes
3answers
459 views

How to implement symbolic Ramanujan's summation in Mathematica?

How to implement Ramanujan's summation in symbolic form in Mathematica? For instance, I want as input the function $f(x)=x$, as output $-1/12$, as input $f(x)=1/x$, as output $\gamma$ (Euler's ...
10
votes
1answer
694 views

Is it possible to find a limit of a sequence given by its recurrence relation?

I need to calculate a limit of a sequence given by its recurrence relation. I tried the following: ...
9
votes
10answers
502 views

Locate Start and End Positions of Repeated Sequences in a list

...
8
votes
5answers
460 views

How can I tally continuous sequences in a list?

I have a stream of data like this: 0001100111100000111111001110000001111111111000000111000111110000... (I can represent them as a list, like in {0,0,0,1,1,...}, ...
7
votes
1answer
381 views

How to find a recurrence relation for a sequence?

I have a sequence given by an explicit formula for n-th term: ...
7
votes
2answers
300 views

`FindSequenceFunction` for sum of hypergeometric terms?

The built-in function FindSequenceFunction is quite good at recognizing hypergeometric terms, i.e. terms $c_k$ for which $c_{k+1}/c_k$ is a rational function of $k$....
6
votes
3answers
444 views

Match a sequence of integers

I would to match a pattern p1 = 0,0,1,0,0 to the elements in listA. The elements are a boolean sequence that may look like this ...
6
votes
1answer
110 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 ...
6
votes
1answer
152 views

Find subsequence A in sequence B A007908 - OEIS

I have sequence A as A007908 - OEIS and pattern B which is a sub-sequence of that sequence A. I need to find index of first occurrence of the given pattern. For example pattern ..1010... I've looked ...
5
votes
2answers
373 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 ...
5
votes
1answer
102 views

An unexpected match when using Condition, Optional and passing a Sequence

Mathematica is behaving in an expected way when passing a parameter with an Optional and a Sequence. Here is an example: ...
5
votes
2answers
2k views

How to find a recurrence relation for a numerical sequence?

This question was inspired by Vladimir Reshetnikov's question (How to find a recurrence relation for a sequence?): Given a finite sequence of numbers, how can we find in MMA a recurrence relation ...
5
votes
1answer
61 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 ...
5
votes
1answer
136 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 ...
5
votes
1answer
235 views

Find the domain in which a sequence converges

I seem to have a lot of problems in the format of: Given the sequence $a_n=\frac{n^\alpha+1}{2n^8+5}$, for $\alpha > 0$, find the values of $\alpha$ such that the sequence converges. However, I ...
5
votes
0answers
81 views

SimilarityRules for SequenceAlignment of two lists

I am trying to use the SimilarityRules option of SequenceAlignment to customize its output. This works perfectly for strings, ...
4
votes
5answers
437 views

Sequence generation

If I wanted to generate a sequence that follows the pattern $$x_{n}=x_{n-1}+\dfrac{1}{2}\left(\sqrt{1-y_{n-1}\ ^{2}}-x_{n-1}\right)\\ y_{n}=y_{n-1}+\dfrac{1}{2}\left(\sqrt{1-x_{n}\ ^{2}}-y_{n-1}\...
4
votes
4answers
255 views

Listing sequence with rules

How would one go about listing all sequences S length 10 made up of a combination of a's and ...
4
votes
3answers
431 views

Generate this sequence more efficiently

Is there a more effecient way to generate the sequence shown below. ...
4
votes
4answers
1k views

How to get Mathematica to show limit of a recurrence sequence?

I want to find the limit of a such a sequence: $f(n+1)=\sqrt{2f(n)-1}, \, f(0)=a, a>1$ How does one do this? Is it possible to have it show the solution algebraically, like it does with ...
4
votes
3answers
402 views

Slow computation of recursive sequences

I want to investigate the asymptotic behavior of the following recursive system: ...
4
votes
3answers
281 views

Long waiting time for computing a summation

It takes a long time to compute the summation below, and I'd like to know if there are alternative ways to compute things faster. When replacing $15$ by $\infty$, then I should get $3^{1/3}$. I need ...
4
votes
2answers
186 views

How can I use sequence in plotting domain?

I would like to plot a function but have a domain defined elsewhere as follows: xrange = Sequence[0, 2π]; Plot[Sin[x], {x, xrange}] However, this doesn't work ...
4
votes
4answers
1k views

Limit of sequence

I tried to calculate the following limit $$\lim_{n\to\infty}n\sin(2\pi en!)$$ Mathematica gets ...
4
votes
2answers
296 views

Sequence evaluation in an If statement [duplicate]

...
4
votes
1answer
102 views

Summing factors of binomial coefficients - get general formula?

Consider summing more and more factors of binomial coefficients: ...
4
votes
2answers
511 views

Generation function of recurrence sequence

I'm trying to find generation function of recurrence sequence ...
4
votes
1answer
78 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 ...
4
votes
0answers
85 views

Pattern match Shortest BlankNullSequence in SequencePosition

Apologies if this has an answer somewhere but I can't find it. From the examples for SequencePosition we are shown that ...
3
votes
4answers
172 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 ...
3
votes
3answers
237 views

Conditional summation

I am a fairly new user to Mathematica and I am strugling with one problem. I would like to run a simulation to figure it out how long the sequence of $\frac{1}{n}$ as $n \rightarrow \infty $ needs ...
3
votes
3answers
112 views

A Fibonacci growth problem

I would like to measure the first column vector as defined here using Mathematica. The list formed of the sum of the adults and infants at each period is a Fibonacci sequence. $\qquad %Translator ...
3
votes
3answers
281 views

Tangled up in sequences and recurrence relations

I took a trip through sequences and recurrence relations and I got tangled up since the documentation didn't help much. I'm sure you can. Given a sequence ...
3
votes
2answers
208 views

How to deduce the Ramanujan's summation of this series?

I have already asked a similar question about Ramanujan's summation in general but received no good answers. Now I am interested in this exact series: $$\sum _{n\ge1}^\Re (24 n + 12 n^2)$$
3
votes
1answer
137 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 ...
3
votes
1answer
62 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: ...
3
votes
1answer
86 views

When does Slot evaluate?

I looked up the related answers, it must have to do with the scope. Toy example similar to mine in structure: ...
3
votes
2answers
194 views

Generating a sequence of lists [closed]

I have learnt how to generate a sequence of numbers, but now I come across a question whether it is possible to generate e sequence of lists. Say, I would like to generate {1},{1,2},{1,2,3},...,{1,2,3,...
3
votes
5answers
105 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 ...