# All Questions

18 questions
Filter by
Sorted by
Tagged with
1answer
62 views

### For loop for two variable at the same time

Can I use for loop for two variables as example show below at the same time? for (int x = 0, y = 0; x < 10 && y < 10; x++, y++)
0answers
27 views

### Running a test over a list to alter list

I'm quite new to this. I have a nested list that represent solutions to an equation. I would like to create a new list that only contains one 'representative' of each element. As an example, imagine I ...
1answer
50 views

### Using elements of list to solve a differential equation

I have created a list as shown in picture. the digits inside f are values of a and q respectively. I want to solve the Mathieu equation.....
1answer
60 views

### Nested Do loops with externally defined iterators [closed]

I want to be able to define a set of iterators for nested Do loops, such as ...
1answer
59 views

### Iterative loop for a given list

Suppose I have the following list: ...
5answers
295 views

### How to build these functions without nested For loops?

I am trying to solve the 8-puzzle using two heuristics, which are: Pieces out of place and Distance Manhattan. After consulting several websites for example see and some books, I'm with some doubts, ...
1answer
44 views

### Series of List manipulation Question

Given a list {{{a1},{a2},{a3},{a}}, {{a4},{a2},{a6},{a}}, {{a7},{a8},{a9},{a}}, {{b1},{b2},{b3},{b}}, {{b4},{b2},{b6},{b}}} I want to change this to ...
1answer
168 views

### Recursion limit reached in a list of recursive functions

Here is a fragment of the code I was working on the other day, that is constructed from a recursive function with Memorization, whose input is prepared in a For loop and then modified as a boundary ...
1answer
50 views

### Error when calculating more than 1 input

I'm trying to solve a problem where I can't do more than 1 calculation inside a Module here. I have a list of numbers where ...
1answer
133 views

### Using a loop to build a list

I'm trying to take a list and then plot it with complex variables. However, when I'm making my list I keep getting Recursion depth of 1024 exceeded during evaluation of {test, nu} and my list is ...
2answers
1k views

### Plot a list of functions in a single graph [closed]

I am trying to solve a problem using Procedural programming paradigm in Mathematica. I want to find a way to plot a list of functions in a single graph. The code is as follow, let me know what is ...
1answer
51 views

### How to write a code for user defined list

I want to make a 1 dimension list like {x,x,...} I want it to be filled by a user, maybe using Input[] function.
3answers
120 views

### How to label output in a Do[…] loop?

I have a huge list = {l1, l2, l3, ...}, which I want to output by labeled rows. My attempt was to ...
1answer
100 views

### Repeating Calculations/Iterations without a specific function

I am trying to repeat an initial condition many times such that I get a desired final output. ONE final output depends on many subsequent calculations from ONE initial condition. But I want to get a ...
3answers
87 views

### Problem while adding elements to list in while function [duplicate]

I'm tring to write a little bit of code that adds a missing element to a list. In specific: given a numbered data set such as: ...
0answers
176 views

### Iteration problem using NestList or Do

I am trying to model a tank with discontinuous flow into the tank and discontinuous flow out of the tank. I do it numerically. You can imagine a tank to which I feed blue balls at timepoint t0, red ...
2answers
63 views

### Not able to apply Scan in place of For loop [closed]

I have been advised to avoid procedural loops and use other functions like Scan,NestList, FoldList, NestWhileList, Inner and Outer. My worry is that if I have a need in which certain critical ...
3answers
536 views

### Functional equivalent of a For loop referring to consecutive elements in a list

I have implemented this function which smooths the values in a list by, if it encounters a zero, replacing this entry by the average of its two neighbours (apart from the first and last values of the ...