To generate and plot random real numbers in Mathematica within a specified time range

In summary, you are asking for someone to produce a set of random real numbers in a specified range in a short amount of time. You also mention that the random numbers are to be integrated with an sigma function and the output is to be plotted against a range.
  • #1
sola maths
8
0
Hi,

I'm trying to write a short code in Mathematica that can generate random real numbers in - say 5 secs, and then plot this against any specified range I want. An additional complexity is that the function I'm generating the random numbers for is embedded in an integral. Here's an example of the algorithm:

From time t = 1 to 5;
Generate random real numbers for f = Integrate[sigma[x]^2,x]
Store f in another variable (say z)

Plot all values in z against a specified range
 
Last edited:
Physics news on Phys.org
  • #2


I am trying to understand what you are asking for

You can do something like
RandomReal[{1,20},1000000]
and that will generate 1000000 random reals between 1 and 20. It might be able to finish that in five seconds.

But you have time and an integral and sigma and x. I cannot tell how those have anything to do with each other. And what does plotting against a range have to do with anything in your steps 1,2,3,4?

Suppose you have to write down a set of simple instructions for a person who knows some mathematics and will follow directions. The person is going to take those instructions, go in the back room and do exactly what those instructions are. This person needs to be able to understand exactly what to do. You don't want him to try to do what he thinks you want, bring it back to you and then you say "well that wasn't what I meant, let me give you a completely different set of instructions" and possibly even repeat this again and again and again until he gets close to understanding what you want.

If you were the person given the instructions in your original post and you didn't know anything about what was wanted except the directions in that post, would you be able to know how to produce the desired result?
 

What is Mathematica?

Mathematica is a computer software program used for mathematical and scientific calculations. It also has visualization tools for creating graphs and plots.

How do I generate random real numbers in Mathematica?

To generate random real numbers in Mathematica, you can use the RandomReal function. This function takes in two parameters, the minimum and maximum values for the range of numbers you want to generate. For example, RandomReal[{0,10}] will generate a random real number between 0 and 10.

How do I set a time range for generating random real numbers in Mathematica?

You can set a time range for generating random real numbers in Mathematica by using the TimeConstraint option with the RandomReal function. This option takes in a number in seconds and limits the amount of time for generating numbers within that range. For example, RandomReal[{0,10}, TimeConstraint->1] will generate a random real number between 0 and 10 within 1 second.

Can I generate a large number of random real numbers in Mathematica?

Yes, you can generate a large number of random real numbers in Mathematica by using the RandomReal function with the "List" option. This will generate a list of random real numbers based on the specified range and number of desired values. For example, RandomReal[{0,10}, 100] will generate a list of 100 random real numbers between 0 and 10.

How can I plot the generated random real numbers in Mathematica?

To plot the generated random real numbers in Mathematica, you can use the ListPlot function. This function takes in a list of numbers and creates a graphical representation of the data. For example, ListPlot[RandomReal[{0,10},100]] will plot a list of 100 random real numbers between 0 and 10.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
257
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
217
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
742
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • Programming and Computer Science
Replies
22
Views
3K
Back
Top