Questions on using and specifying iterators used in Mathematica functions.

learn more… | top users | synonyms

4
votes
2answers
73 views

Finding the smallest starting number producing a Collatz sequence of length 125 which ends with a value > 4

I'm supposed to do a Mathematica function that selects the smallest number not less or equal to 4 after 125 iterations. I am not good at coding, so some help/advice would be awesome. My code so far. ...
-1
votes
1answer
235 views

Tweaking a code for basins of attraction

NOTE: Whoever finds a working way for obtaining the basins of attraction in the $(x,\mu)$-plane will add his/her name along with @Quantum_Oli in the list of the acknowledgements of the resulted ...
2
votes
3answers
133 views

What is the correct way to perform the Gram-Schmidt process?

Im trying to do a simple processing in Mathematica. My original code was in Matlab. Part of the computation is Gram-Schmidt process, which is an iterative calculation. Every vector is changed ...
1
vote
1answer
215 views

Basins of attraction of equilibrium points

The Henon-Heiles potential is the following V = 1/2*(x^2 + y^2) - y*(1/3*y^2 - x^2); which has four equilibrium points ...
0
votes
0answers
28 views

Problem using an iteration in a product

I'm trying to solve a general solution for this productive iteration, but the program gets stuck in the calculation and says:$RecursionLimit::reclim: Recursion depth of 1024 exceeded. >> Here is the ...
0
votes
0answers
46 views

Iterative process of least squares solution

I'm doing an inversion of gravity data in which the least squares solution is: V^(k+1) = V^(k) + Inverse[W].(Transpose[A.(Inverse[W])]).α; where ...
4
votes
2answers
130 views

ReplaceRepeated as a Looping construct?

There are a lot of discussions about looping constructs (notable example here). Wolfram language guides, as usually, contain most relevant links. Looping constructs guide has the following part on ...
3
votes
3answers
255 views

How would I write iterative code to try multiple coefficients for an equation?

So, I'm trying to solve a class of equations, and get all the solutions in a list. The general form looks like this: c == a*Sqrt[1-n] PlusMinus[b * Sqrt[n]] ...
8
votes
5answers
314 views

How to iterate over the columns of a Dataset?

I have a Dataset with a simple structure, like this: ...
1
vote
1answer
77 views

Tiny question about Indexed[x,n]

Maybe I should apologize for this silly question, but the documentation for Indexed is very short and not explicit. I have an equation with variables ...
1
vote
0answers
60 views

Problems with indexes in a Do-cycle and CoefficientArrays

I have a system of linear equations with variables $A_n$ and need its coefficients in a matrix form (Transform linear system into a matrix form). I'm trying to do that through a ...
3
votes
1answer
51 views

Reals in Range; unexpected result for non-standard Precision

I think I have encountered advice against using inexact numbers in specifications of ranges and iterator many times. I don't think I ever saw an example of unexpected results though, but today I found ...
4
votes
3answers
113 views

How to evaluate an expression over a particular list of tuples?

NOTE: This question is very similar to this one but I realized reading at the answers that I made a mistake in the equation AND I was not clear enough about what I need (my apologies): I want to ...
1
vote
3answers
106 views

Use Do to evaluate an expression over two indices $i \ne j$ (over a list of tuples)?

I have an expression of the form: expr1[i_,j_] = Sum[\[Beta][j]*\[Phi][i, j]* C[i] I would like to evaluate this expression over i=1:4, j=1:4 with i!= j. One ...
0
votes
1answer
60 views

Beginner: Iterative Sequence for Vector Function

I want to create an iterative sequence for two Vectorfunctions, where both are dependent on the same variables and i represents the vector. For simplicity let's ...
2
votes
1answer
106 views

Generating by plots by rerunning code

I am new to Mathematica. I created a code where I can evaluate a parameter (denoted by PoA) for a random instance of a directed acyclic graph. The code is below. ...
2
votes
1answer
80 views

Abstract iterator in Do

I'm trying to write a module. Its input is a matrix (tensor), the module should return new tensor with increased rank with 1. The new tensor is defined as $$ O \Rightarrow N_{\alpha \beta \ldots ...
0
votes
1answer
51 views

Folding 3-variate function with 2 iterator

I have a function say $f$ and some initial point $x$ and pairs of iterators $\{\{a_1,b_1\},\{a_2,b_2\},...\}$ I want to foldlist as follows: $\{x,f[x,a_1,b_1],f[f[x,a_1,b_1],a_2,b_2],...\}$ can ...
3
votes
1answer
71 views

How do I make Mathematica nest argument changes?

I want something like Nest[f,x,n], but what where f is an argument change like a pushforward and x[t] is a function, for example, symbolically, and not in any sort of code: $$ F{x[t]} \equiv x[2t + ...
1
vote
4answers
115 views

NestWhileList, control to show the second sequence

For example,each number will end up with 89 or 1, however , How can I generate a sequence with two sub sequence. f[n_] := IntegerDigits[n]^2 // Total One sub ...
3
votes
1answer
138 views

Parallel Apply on a deeply nested expression

I have a deeply nested expression, i.e. something like {{{{...}..}..}..}, and I'd like to use Apply in a parallel fashion, e.g. ...
2
votes
3answers
93 views

Perform For-loop and show output which meets a certain criterion

I am new to Mathematica and I have a For loop like so: For[i = 0, i < 15, i++, PowerMod[i, -1, 15]] Currently it doesn't output anything. The calculation I am ...
0
votes
1answer
98 views

How to obtain a convergent solution iteratively for a linear system of equations

I am working on a problem that requires an iterative procedure to solve a linear system of equations, the system of equations in matrix form is: $$\underbrace{\begin{bmatrix} r_{11} & r_{12} ...
0
votes
1answer
684 views

How do I write nested for-loops?

Looking through the reference.wolfram, I couldn't see an example of how to write a multiple line "for" loop in Mathematica. I need to nest many for-loops in such a way I can do many things in the ...
0
votes
1answer
79 views

I'm trying to iterate a function with two variables [closed]

I have a function that calculates temperature that is dependent on both temperature and time. I want to be able to iterate the function to calculate a new temperature and then use that as the next ...
5
votes
4answers
574 views

Plotting piecewise functions

I have a list of N functions called functionList. N can be any number. Also, I have a list ...
4
votes
1answer
122 views

Iterating `Log` infinitely

How is it possible to find the limiting value of Log[x Log[x Log[x Log[...]]]] in Mathematica? Apparently, it should give ...
1
vote
1answer
82 views

How to make a table of successive values

I want a list, where each entry is of the form {x,y}. I want x to go from $-\pi / 2$ all the way up to $\pi/2$. I also want ...
2
votes
0answers
63 views

How to use nest to reduce the memory eatting of mma?

I enconter a problem about number: If we have 5+3+2=151022 9+2+4=183652 8+6+3=482466 5+4+5=202541 then 7+2+5=? It is easy to get the first two group of numbers? for the ...
1
vote
1answer
76 views

Importing data from files designated in an InputString dialog box

I want to use a loop to input several strings which will be used to import a file. The number of strings to be imported will vary, so the loop should recognize the number of strings and stop after ...
1
vote
2answers
101 views

Generating a table with two entries for each i

Disclaimer: I'm not a mathematica expert, I have some programming experience but am still learning how to work mathematica. Also, some of the code from the first block here is not my own, ...
2
votes
1answer
177 views

Dynamic process on graph

I have a question, which I failed to find an answer to myself. I'm a casual user of Mathematica, but do have some knowledge about Dynamic module and other "Advanced" features. My problem is ...
0
votes
1answer
211 views

How can I resolve the insufficient memory to complete the computation problem for solving function with iterated variables?

I am trying to solve for a value x in a function where the variables varies with iterations of K. Also, there is one variable called "rvsum" which is updated with a certain formula as well. I have ...
2
votes
2answers
169 views

How to get the current index during a Scan iteration?

Is there a special keyword to get the current index in Scan ? For example, let say I have the following code : ...
3
votes
2answers
117 views

How to modify the elements of a list in a loop?

I have a list with points coordinates. And I'm trying to traverse it and perform some matrix operations on each point. But I have a problem with storing modified points in the initial list instead of ...
4
votes
3answers
364 views

Skipping over iterator values in a Table

I have been using the built-in function Table for some computations. (The following is not an actual representation of the equations I am using). ...
5
votes
2answers
301 views

Table with multiple iterators running parallel

I want to use Table to generate a list, but it only allows one iterator to increment at a time. So in ...
1
vote
2answers
110 views

How to use Fold with 3 variables [duplicate]

Suppose I define f[x_,y_,z_]:=x+y+z I wish to apply the Fold function to f along the lines of Fold[f,1,2,Range[10]] In ...
5
votes
1answer
219 views

Procedural to functional style

The following code generates an iterative mapping of some trigonometric functions. I have a couple questions about it. The first question is how to optimize this iterative process using mathematica's ...
0
votes
3answers
308 views

saving outputs of loop

I am stuck on a problem. I have outputs generated at every iteration of a do loop. However, I want to save the outputs in some other file format, like text file etc, in such a way that i must be able ...
0
votes
1answer
259 views

Index of iteration inside NestList [duplicate]

I have a list of RandomReal: delta = RandomReal[{-0.01, 0.01}, 1000] I want to add each element of the list to the ...
3
votes
1answer
84 views

.NET link - index of property

I have a property in .NET Type, which is actually a generic list of objects. When I try access the property using numeric index e.g. 10, this works. However when I iterate through indices using ...
0
votes
1answer
129 views

How to generically produce iterators (to loop over many variables)

A generalization of, for example: Do[(* stuff *), {x, listx},{y, listy},{z, listz}] I can almost do this with Table, but I need a way to flatten the outer ...
1
vote
1answer
119 views

How do I produce iterative equations and bifurcation diagrams?

I need to produce orbit diagrams for different values of x for the following equation: f[r_][x_]:= r*x - x^3 I'm fairly new to Mathematica, so I haven't had a ...
0
votes
2answers
56 views

Filter through list and lump data [duplicate]

I have a very large data set (around 3000) that looks like: ...
0
votes
1answer
164 views

Slow evaluation of complicated Table

I have a system of recursive equations x[t+1]:=f[x[t],p[t-1],a[t],a[t-1]]; p[t+1]:=g[p[t],x[t-1],a[t],a[t-1]]; a[t+1]:=h[x[t],p[t],a[t],a[t-1]]; I want to ...
1
vote
1answer
168 views

invert system of two parametric ODEs and plot results of do-loop

I can solve this system of parametric ODE (u is the parameter,while g,e and ...
0
votes
0answers
141 views

Iteration of multiple functions that feed into each other

I'm trying to figure out how to iterate through several functions that all "feed" into one-another but am having some trouble. Here are the variables: ...
1
vote
3answers
250 views

Table iteration over two ranges

I am trying to create a Table where the iterator has two ranges with different iteration steps. Let's consider a simple example: I want to find the square of the ...
2
votes
2answers
134 views

Plot with sum and binomial command

A few days ago I asked about a problem with plotting a sum. You advise me to use Evaluate option, and that helped me very. But now I have a very similar problem, but i can't find the mistake. I have a ...