Linked Questions

1
vote
2answers
74 views

How can I construct a matrix by programming in mathematica?

I want to write a matrix in Mathematica by programming. How can I write it? The matrix is : $ M= \begin{bmatrix} 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & ...
1
vote
2answers
87 views

For loop not working as expected from a C programmer's perspective [closed]

Why does Print[n] produce output inside a For loop, while Sqrt[n] (as well as many other ...
0
votes
2answers
201 views

Nested For loops simplified

In order to avoid a deep set of nested For loops, I came up with this method to do it with one For loop. The range of each level's For loop counting variable k1, k2, k3,... is 0 to b, and n is the ...
1
vote
1answer
53 views

Plotting a family of functions with For [closed]

I'm trying to plot a family of functions differing only by a constant $c$. The function is: $2x^2-5x+c$. In order to plot them I'm using the following code: ...
5
votes
1answer
413 views

Random walk in one dimension — meeting of two particles

I'm new to Mathematica and still teaching all by myself, hope you bear with me. I have the code: ...
2
votes
2answers
82 views

How to automatically change plotting options for an array of plots?

I'm working with an array of plots. I'd like to change the color and the legend for each of the plots in my array. For example, working with 10 plots: I generate the empty array of plots ...
0
votes
2answers
110 views

Exporting result of calculation to file at each step of iterative routine

I am performing a calculation that involves a triple "For" command. My goal is to export the table of all values of some function (which depends on the three indices) to a data file for statistical ...
1
vote
3answers
245 views

Extracting a 2 x 2 matrix from a 9 x 9 matrix [closed]

I have the following code: For[i = 1, i <= 9, i = i + 8, For[j = 1, j <= 9, j = j + 8, Print[k[[i, j]]] ] ] The code prints a column of the ...
1
vote
2answers
100 views

What is wrong with the Mann iteration?

I have written the Mann iteration's code for the mapping $\frac{z}{1+z^2}$, in Mathematica, but it is very slow. In fact it needs more than 200 seconds for obtaining 17th iteration, while Matlab does ...
2
votes
2answers
535 views

For/ Do loop on a lists of two variables

I am trying to get an output of the following kind Out = Do[Evaluate[f[x,y]],{x,table1},{y,table2}] Here Out is a N-times-1 dimensional array/list and N is the ...
2
votes
1answer
93 views

Speeding up code for (0,1) Matrix and Calculating Recurrent Rate (RQA analyses)

I am trying for several days make this code faster. The function just takes a time series makes a Distance matrix of it and then compares components of it with Variance of that series and if component ...
0
votes
1answer
622 views

Creating an array with “For” loop

I need to perform a number of operations within a For loop and store the results in an indexed array (without using the Append function) For examole (to make it ...
0
votes
2answers
623 views

How to write if statement and for loop? [closed]

I am trying to write a function that will find a sum of all diagonal elements of matrix. I don't know how to do it correctly. This is how I tried do do it. ...
4
votes
1answer
78 views

How to display a True/False table [closed]

Below is my written program ...
0
votes
1answer
266 views

Chi square minimisation wrt variables within an integration?

I'm trying to fit a model curve to some data by performing a chi square minimisation wrt three parameters $a,b$ and $NN$. The trouble I am having is that the variables with which I want to minimise ...

15 30 50 per page