4k views

### How do I show the combined plot from the do-loop?

I have a do-loop to do the calculations from a set of data and plot the graphs with different results, that was obtained from the calculations. I was able to get multiple graphs but I want to ListPlot ...
3k views

### converting Matlab program to Mathematica code

I have the following Matlab program; ...
4k views

### Finding the area of a circle using monte carlo simulation [duplicate]

I wrote the following code to find the area of the circle $x^2+y^2=1$ using monte carlo simulation : ...
1k views

### For-loop not working as I expect

I want to do this: When 10 <= t < 130, give t -> 1; When 130 <= t<300, give <...
2k views

### Assigning a particular value to array elements

I have an array of 10000 elements. I want to randomly assign energy to these 10000 elements using Gaussian or Exponential distribution, such that each time a particular element is selected its energy ...
480 views

### What is the right way to write a function that includes other functions?

I want to include multiple sub functions: $b(x) = 10x$ $w(x) = s + b(x)$ $c(x) = x^2$ into two main functions: $ua(x) = w(x)-c(x)$ $ub(x) = w(x)-c(x)^2$ As a reaction to this answer, I wrote ...
255 views

### How to avoid writing $K$ loops?

I want to evaluate a mathematical function of $K$ variables each of variables varying between 1:N. One way to do this is writing $K$ loops and varying variables accordingly, as shown below: ...
165 views

### Achieve performance that is competitive with numpy [duplicate]

What are the best practices to ameliorate time performance of Mathematica? As a practical example how we can decrease timing below? ...
479 views

### CUDA image processing

I am having an issue with image processing involving CUDALink. ...
2k views

### Draw grid lines at multiples of k

Here is a beginner's question: when creating plots with mathematica, I want the grid lines to be at multiples of a constant value. E.g. in the following plot, the vertical grid lines are at multiple ...
393 views

### Alternative forms to Table for iterating over replacement rules

I have a multivariate polynomial x. I get coefficients of various monomials using CoefficientRules, which returns a list of ...
7k views

### How do I store values in a for loop into an array and then plot that array? [duplicate]

What my title said and I want to plot the values of the array. still new to mathematica and programming so its hard to formulate my question just right
907 views

### 3 hour calculation? ParallelMap & ParallelTable

I'm having some problems with slow Mathematica code... I'm basically doing a computation that's is expected to take 3 hours (!) in my Core i7 with 4 processors... I'm basically computing an index (of ...
The following example either finds a factor of the number $n$ or returns a message saying that the number in question is prime (I specifially wrote this to demonstrate my question below). ...