Linked Questions

1
vote
1answer
162 views

Two actions in the loop body

Help me please, how I can write two action in the body of the cycle "for"? For example, if I need to write Print[] and Append[] at each iteration.
1
vote
1answer
48 views

How to sort the “do” output?

So I have function (FindCoefficients) that iterates through some values to find the maximum value for a function. It is much quicker to hold the non-linear values constant and do a find maximum for ...
3
votes
2answers
466 views

Print characters from list with a For-loop

Suppose I have the list primary = {"b","a","e"} I want to get the following output with a For-loop (or While-loop) "b" "a" "e" My code is: ...
0
votes
1answer
333 views

Parallelizing nested for loops

I'm currently computing nested for loops. I count up a few counting variables and compute a value for each set of counting variables, then that value is added to an array. It is a way of adding up ...
4
votes
3answers
525 views

Dot products and For-loops

I'm taking a class where we're working with matrix applications inside of Mathematica. In this case, we're analyzing senatorial votes that have been numericized so that a value of 1 corresponds to "...
13
votes
1answer
720 views

Pascal records and Mathematica programming

Background: "experienced" Pascal-programmer (DOS-era, never got into OOP) proud owner of Mathematica ver 11.2 have used Mathematica for years to do my share of number crunching and plotting to ...
2
votes
3answers
153 views

Evaluating number of iteration with a certain map with While

Beeing used to programming in C-like languages I am struggling with iterations and loops with mathematica. I am trying not to use the For command, as already lots of people recommended. I am trying ...
3
votes
2answers
201 views

Correctly defining the return of a procedure

I am sort of new to mathematica and I am struggling with how to correctly set the return of a specific function which is a procedure. I am give the following task: Given the map $x_{n+1} = r x_n (1-...
5
votes
3answers
1k views

How to speed up a process

I am wondering how to speed up the following code: Currently it takes more than two sec to be processed. ...
3
votes
2answers
2k views

For Loop and Sum

I am requested to do a sum of the first fifty positive even numbers by using For loop. The For loop that I created is ...
5
votes
7answers
342 views

Computing only Prime Powers with NestList

Is there a simple way to compute only prime powers of a function f with NestList? That is, I want to compute: {f[x_0], f^2[x_0]=f[f[x_0]], f^3[x_0], f^5[x_0]...} ...
1
vote
2answers
205 views

How can I combine the output of a `For` loop into a list?

I am currently writing on a code to get RandomNumbers which are geometrical distributed. But i need the output in one list because i want to plot the output Can anyone help me? Here is the current ...
0
votes
1answer
805 views

Solve a system by Cramer's rule using loop

Consider the linear system AX=B,where A={{3, 0, 2}, {-3, 2, 2}, {2, -3, 3}},B={{3}, {-1}, {4}} and x=...
1
vote
1answer
90 views

Is there any way to save time using of “Cross” or “Table”?

I need to solve a equation by NDSlove, so I write the equation first, but it takes me a lot of time. The follow is my code ...
0
votes
2answers
50 views

Expressing values from an evaluated If function as a list

For[i = 0, i < 4, i++, Print[i]] gives the result: 0 1 2 3 by the definition of the If[] function. Given a much longer ...

15 30 50 per page