Questions tagged [sequence]

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

Filter by
Sorted by
Tagged with
5
votes
2answers
368 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
37 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
1answer
71 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
97 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
57 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
58 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
75 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
95 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
431 views

Generate this sequence more efficiently

Is there a more effecient way to generate the sequence shown below. ...
5
votes
1answer
58 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
79 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
66 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
28 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
54 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
133 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
93 views

Generating Manipulate variables from a list of rules

I have the following list of rules: ...
3
votes
2answers
83 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
58 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
48 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
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 ...
2
votes
3answers
78 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
169 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
53 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 ...
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: ...
2
votes
1answer
186 views

Find Sequence Function Error?

I am suprised that mathematica is not able to find the function for the following sequence: ...
1
vote
1answer
70 views

Extracting blocks of “adjacent” XMLElements

I have a file that, when imported as an "XMLObject", returns an XML object that possesses this general structure: (I've stripped the inconsequential junk wrapping ...
1
vote
0answers
67 views

Possible bug with `FindSequenceFunction`$.$

Consider the following code: g = Table[Sign[StieltjesGamma[n]], {n, 0, 30}]; s = FindSequenceFunction[g]; The result is a certain ...
1
vote
1answer
114 views

Finding general formula for this recursion function

I have a recursion relation defined as ...
1
vote
0answers
56 views

Speed up for SequencePredictorFunction?

From Google Dive: SequencePredictorFunction is here, along with my test data. From pastbin: prediction function and data is here. Using the ...
2
votes
0answers
94 views

Find the second longest common subsequence?

I am trying to determine that how my sequence(probe) "hits" against a long sequence(genome). The LongestCommonSubsequence in Mathematica gives the first longest common subsequence between two ...
2
votes
1answer
54 views

How can I create a sequence of solutions to an equation?

I'm brand new to Mathematica and having to use it for my PDE class. One of my homework questions involves plotting the first few terms of the Fourier series of a solution to a PDE, but the eigenvalues ...
0
votes
1answer
93 views

Sum of Sequence inside a replace rule? [duplicate]

I'd like a replacement rule that replaces derivatives with their total order. I tried ReplaceAll[Derivative[x__] -> Plus[x]][Derivative[1, 1]] but it doesn't ...
0
votes
1answer
50 views

FindSequenceFunction applied to basic trig sequence

I an not too familiar with FindSequenceFunction. Is there a trick to make Mathematica produce the obvious sequence function for this sequence? Example 1 ...
2
votes
2answers
108 views

Alternatives to Sequence[] as a nonexistent expression element [duplicate]

I stumbled upon this code by Leonid Shifrin. He uses Sequence[] to create void or non-existent output. I was wondering whether this is really the best way to ...
2
votes
3answers
114 views

How can I implement the binomial transform?

How do I implement the binomial transform? I've tried defining a matrix P = Table[(-1)^k Binomial[n, k], {n, 0, m}, {k, 0, m}] and having this act on my ...
0
votes
1answer
83 views

Is there a simple way to convert a list to a sequence? [closed]

I have a list of couples like this for example : list = {{1, 2}, {2, 3}} In practice my list can be of any size. I need to put a condition in ...
0
votes
0answers
76 views

Is there a **simple** way to define a function on a variable sequence?

I have a List j={j[1],j[3],j[6]}. But this list is in fact a variable of my code, so i could have j={j[6],j[10]} either. I need ...
3
votes
1answer
104 views

Hazrat Exercise 9.2: Sequence resolves to Factorial?

Throwaway comment in Hazrat p105: Observe that Range[10]/.{x_,y___}->y/x amounts to 10! I can't for the life of me figure out how this works. It seems to ...
1
vote
1answer
125 views

Constructing a list of all three-element subset of a list [closed]

The list I have is {a,b,c,d,e} I would like to use ReplaceList to construct a list of three-element subset of the above list. ...
4
votes
1answer
102 views

Summing factors of binomial coefficients - get general formula?

Consider summing more and more factors of binomial coefficients: ...
9
votes
10answers
499 views

Locate Start and End Positions of Repeated Sequences in a list

...
2
votes
1answer
59 views

Partition lists into sub-lists based on whether they are consecutive or not [duplicate]

I am new to Mathematica and would appreciate any help. I'd like to partition my data which is comprised of {time x analog input} into sublists of consecutive time. In other words, my data looks like ...
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 ...
1
vote
1answer
83 views

Why does the FindSequenceFunction command sometimes succeed with subsequences, while failing for the longer sequences?

I've encountered this phenomenon a number of times--and can provide specific examples if requested. For example, I have a 75-long sequence of rational numbers for which the FindSequenceFunction fails ...
6
votes
1answer
102 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 ...
3
votes
3answers
235 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
111 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 ...
15
votes
4answers
621 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
1answer
207 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 ...
1
vote
1answer
85 views

How to get LogPlot to accept a Sequence for its Min/Max Limits [duplicate]

If you use Plot like this, Plot[Sin[x], {x, 1, 5}] it produces the correct Sin graph ...