Skip to main content

Questions tagged [sequence]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
35 views

How can this custom function generate the corresponding arithmetic sequence?

A function is to be constructed that, given an input of a positive integer value m, automatically enumerates all possible cases. Starting with an arithmetic sequence of length 4*m + 2, two terms are ...
csn899's user avatar
  • 4,523
0 votes
0 answers
112 views

How to solve this problem combining sequences and reasoning using code?

QUESTION: Let $m$ be a positive integer, and let $a_1, a_2, ..., a_{4m+2}$ be an arithmetic sequence with non-zero common difference. If removing two terms $a_i$ and $a_j$ ($i < j$) leaves $4m$ ...
csn899's user avatar
  • 4,523
1 vote
2 answers
129 views

Convergence of $\left\{n!\sum_{k=1}^{n!}\frac{1}{k^{\frac{3}{2}}}\right\}$ as $n\to \infty$ using Mathematica or otherwise

Using Mathematica or otherwise, I need to find the convergence or divergence of$$\lim_{n\to\infty}\left\{n!\sum_{k=1}^{n!}\frac{1}{k^{\frac{3}{2}}}\right\}$$ where $\{x\}$ denotes the fractional part ...
Max's user avatar
  • 155
0 votes
2 answers
91 views

How to display the specific general term formula of Fibonacci sequence? [closed]

RSolve[{a[n] == a[n - 1] + a[n - 2], a[1] == 1, a[2] == 1}, a[n], n] The general term formula obtained by the above code is: ...
csn899's user avatar
  • 4,523
4 votes
4 answers
297 views

Replacing string values with one of the sequence-functions

Given the following list of rules (which might contain duplicate keys), I want to replace the string values with the first preceding numerical value. ...
eldo's user avatar
  • 81.4k
6 votes
3 answers
173 views

Use sequence-functions to find certain sublists

I want to split a list of positive Integers into sublists whose ascending elements differ by 1. list = {1, 0, 1, 0, 1, 4, 5, 6, 5, 8, 1, 2}; This can be done ...
eldo's user avatar
  • 81.4k
3 votes
1 answer
103 views

How to get the function-basis as they appear in the expression?

I have the following expression containing functions eg. Log, PolyLog etc, ...
BabaYaga's user avatar
  • 1,897
4 votes
1 answer
115 views

How can I find some first terms of a sequence?

I have a sequence knowing that $a_1=15$, $a_{n+1} = a_n + \sqrt{2a_{n+1}-a_n}$. I want to find some the first terms. I tried by my hand ...
Thuy Nguyen's user avatar
  • 1,131
2 votes
1 answer
101 views

Why is there such a problem with finding a formula for the general term of a sequence?

FindSequenceFunction[{1, 2, 5, 14, 41}, n] 1/6 (3 + 3^n) You can directly calculate the general term formula above Why is it impossible to find the general term ...
csn899's user avatar
  • 4,523
0 votes
2 answers
93 views

Generating sequence from a number with Precision

This question was from the End-Semester question paper of the previous year of my Course on Wolfram Mathematica - Apparently when I try to code it, something is going wrong with respect to Precision - ...
Venkatakrishnan's user avatar
6 votes
4 answers
428 views

Subdivide a sequence

Yesterday I couldn't solve a problem which seemed to be rather simple. I tried RepleaceRepeated, SequenceReplace and similar ...
eldo's user avatar
  • 81.4k
20 votes
6 answers
901 views

Peaks, plateaus and ledges

I want to find the peaks, plateaus and ledges of an integer sequence, but all my attempts failed. 1. Example list ...
eldo's user avatar
  • 81.4k
5 votes
4 answers
187 views

Joining constant arrays determined by a subsequence of contiguous block of ones

I have the following: data = {15, 25, 35, 45, 55, 65, 75, 85, 95, 105}; selector = {0, 1, 1, 0, 1, 1, 1, 0, 0, 0}; I want to create the following list from ...
IntroductionToProbability's user avatar
9 votes
8 answers
1k views

How can I define a sequence of Integers which only contains the first k integers, then doesn't contain the next j integers, and so on

I need a list of integers to check if a variable has one of the values of the list. If[ MemberQ[List,x], Green, Red] The list contains integers and is characterized ...
100xln2's user avatar
  • 437
1 vote
1 answer
67 views

Why doesn't Sequence@@ work inside Manipulate[]?

I'm trying to use Manipulate[] and I need to have a non-fixed amount of sliders. I tried writing something like: ...
Nuno Catalão's user avatar
1 vote
0 answers
42 views

Sequence reconstruction from ordered subsamples

Given a sequence (we'll assume of integers) like seq = {1, 0, 0, 1, 2, 0, 1} I can take a random permutation ...
b3m2a1's user avatar
  • 47k
8 votes
4 answers
340 views

Split list into ascending sublists

I would like to split a list into non-overlapping, ascending (more precisely, non-descending with ≤) sublists. The function would be close to LongestOrderedSequence,...
SnzFor16Min's user avatar
  • 2,240
6 votes
4 answers
242 views

Find shortest subsequence

We will deal with arrays of chars, but not strings! Let we have the next three arrays: ...
lesobrod's user avatar
  • 1,849
0 votes
1 answer
45 views

Derivative with respect to a sequence

I want D[Subscript[a, k],Subscript[a,j]] to return something like the Kronecker delta. Is this possible?
Aakash Lakshmanan's user avatar
2 votes
1 answer
98 views

Limit of Taylor coefficients

I want to calculate the following limit: b[n_] := (D[1/(1 - t), {t, n}] /. {t -> 0})/Factorial[n] Limit[b[n], n -> ∞] (* Indeterminate *) where ...
SKS's user avatar
  • 33
0 votes
1 answer
91 views

When running code to compute a sequence, loop variable gets set to a constant

I would like to write Mathematica code to read in a list of sequences, and print the sequence definition ($a_n$), along with the sequence evaluated at a few values of $n$. ...
mjw's user avatar
  • 2,166
5 votes
0 answers
64 views

How to use Shortest[___] with Sequence pattern matching?

Shortest[] doesn't appear to work with Sequence s. Is this a bug or a feature? What can I do to force the following ...
podge cassidy's user avatar
0 votes
1 answer
22 views

Confusing result when pattern matching a BlankSequence (__) to a list, then calling unary function on the list [duplicate]

The following makes sense to me: In[1] = f[a, b] /. f[x__] -> x Out[1] = Sequence[a, b] In[2] = f[a, b] /. f[x__] -> {x} Out[2] = {a, b} However, the ...
xdavidliu's user avatar
  • 191
11 votes
8 answers
675 views

Select data from a structured list

Let's suppose we have the following structure of data ...
Vaggelis_Z's user avatar
  • 8,790
1 vote
2 answers
101 views

we want to get all possible values with $a_1$

I would appreciate it if somebody could help me with the following problem: Given $$a_{n+1}=\begin{cases} \dfrac{a_n}{2}& (a_n \: \text{even})\\ n{a_n}& (a_n \: \text{odd})\end{cases},\:a_8= ...
Young's user avatar
  • 269
0 votes
1 answer
85 views

Problem with For Loop when evaluating a recursive function at multiple points

I am running into problems with my For loop when trying to evaluate my expression. Fix some parameter values : ...
Anna MSJ's user avatar
5 votes
5 answers
152 views

Rewrite the list without certain elements in the sequence

I have a list1: ...
Mam Mam's user avatar
  • 1,883
4 votes
4 answers
215 views

One-to-multiple values relation from two excel columns

I have excel file with two columns: After data import I have the following list: ...
Филипп Цветков's user avatar
3 votes
6 answers
306 views

Subsequences with distinct values

(this question was modified after initial answers) For a sequence x = {6,4,2,4,2,4,6} y = Subsequences[x] gives the list of ...
Jamie M's user avatar
  • 515
5 votes
4 answers
164 views

Determining the run length of elements in a list that satisfy a pattern

Is there a simple way to determine the run length of elements in a list that satisfy a pattern? For example, consider the following list: ...
1689vantil's user avatar
3 votes
2 answers
192 views

How to insert a list in the second argument of Table?

I wrote the following table: k = 4; T = Table[{a[n], 0, 1}, {n, 1, k}] Which generates: ...
Red Banana's user avatar
  • 5,411
5 votes
1 answer
87 views

Isolating sequences from a list based on a formula

SeedRandom[4]; alist = RandomInteger[{-4, 4}, 100] From this list, I can isolate similar neighbors of length two: ...
Syed's user avatar
  • 56k
6 votes
4 answers
249 views

Selective deletions from a list

i have two lists of strings with unequal numbers of subelements in each. i would like to remove from lis2 all instances where a pattern in lis1 appears in lis2: ...
Suite401's user avatar
  • 4,873
2 votes
2 answers
199 views

Trouble understanding function composition?

I made the following code: Cs = {{0, 1}}; f[x_] := (Clear[s]; s = (x[[2]] - x[[1]])/3; Splice[{{x[[1]], x[[1]] + s}, {x[[1]] + 2 s, x[[2]]}}]) Observe that we can ...
Red Banana's user avatar
  • 5,411
0 votes
0 answers
48 views

How to find the sequence function $f(n,x)$ of the three given functions?

I have the three functions $f(2,x)$, $f(3,x)$ and $f(4,x)$ where $x>0$ ...
math2021's user avatar
  • 749
2 votes
2 answers
328 views

While loop not working problem [closed]

I am new to Mathematica ,and I am trying to implement this while loop which adds all odd Fibonacci numbers less than or equal to 2 million but it keeps outputting 0 for sum. Any solutions for that? ...
Brotos's user avatar
  • 31
0 votes
0 answers
46 views

Problem with FindGeneratingFunction

I have a lengthy function of a real parameter $n$ that generates values $val$ for each $n$ {$n$, $val$}: ...
Sid's user avatar
  • 987
6 votes
2 answers
215 views

Longest common subset sequence with gaps

I would like to find the longest common subset (including a gap of x) within two lists. Example: A = AAABBBBCCCCC B = CCCBBBAAABABA We can use ...
Teabelly's user avatar
  • 1,004
1 vote
1 answer
126 views

RSolve unable to solve the equation

I gave the following code as input: RSolve[x[n + 1] == 1/2 x[n] + 2 Log[x[n]], x[n], n] Mathematica gave the same output: ...
coconut2000's user avatar
0 votes
0 answers
62 views

Is there a concise way to generate a continuous less-than relationship?

Actually, I have a ton of variables, Let me simplify it to 4 in this post. vars = {a, b, c, d}; 0 < Less @@ vars < 10 0 < (a < b < c < d) < ...
yode's user avatar
  • 26.9k
0 votes
1 answer
86 views

How to solve this RecurrenceTable in Mathematica

I would appreciate if somebody could help me with the following problem: Q: How to define this in Mathematica. ...
Young's user avatar
  • 269
0 votes
1 answer
254 views

Variable dimension tables with variable ranges

I need to construct a table that has variable dimension and variable ranges (see for tables with variable dimensions and constant ranges, e.g., this question). Suppose there is a list ...
Keyspire's user avatar
  • 359
3 votes
1 answer
91 views

A possible issue in combination of the Infix operator ~ with Sequence [closed]

There are other similar questions on this site about using the Infix operator for more than two arguments, which I have read. But there is one thing that I wasn't able to understand and couldn't ...
polfosol's user avatar
  • 952
0 votes
0 answers
77 views

FindSequenceFunction with very small numbers

I need some help with FindSequenceFunction because at the moment it seems like a black box to me. For example, it deals with ...
ThunderBiggi's user avatar
  • 1,195
5 votes
1 answer
102 views

Patterns are not Sequences are not Lists, or: Global Function Argument Reversal

H[z_] := z /. {F[p__] -> F[Reverse[p]]} F[{x, y}] + F[{x, z}] + F[{}] // H Almost. It gives an annoying "Nonatomic Reverse" error message at the ...
Hauke Reddmann's user avatar
2 votes
1 answer
80 views

Defining function with arguments in a specific pattern similar to Graphics[]

I'm trying to define a function that is of this form: ...
Timevortex's user avatar
2 votes
0 answers
113 views

Finding recurrence relation from an inexact numerical sequence

Consider the recurrence relationship d[0] = 0; d[i_] := (1 + Sqrt[1 + 4 d[i - 1]^2])/2 /; i >= 1 which generates the following sequence (generated by using <...
TDH's user avatar
  • 489
1 vote
0 answers
38 views

What subsequences does SequenceReplace consider

Consider SequenceReplace[{a, b, x, x, a, c}, {a, e_} :> e]. What subsequences does SequenceReplace consider? The ...
user106860's user avatar
0 votes
1 answer
69 views

Using :> vs -> in SequenceReplace

The first example on the page for SequenceReplace is the following: SequenceReplace[{a, b, x, x, a, c}, {a, e_} :> e] ...
user106860's user avatar
1 vote
1 answer
262 views

Extract function argument sequence

Is it somehow possible to access and reference the sequence of arguments of a non-pure function? For example if I want to take the derivative with respect to the n'th argument, a pseudocode example ...
jabberwocky's user avatar