Mathematica How to Generate and Plot Random Real Numbers in Mathematica?

Click For Summary
The discussion centers on generating random real numbers in Mathematica within a specified time frame and plotting these numbers against a defined range. The user seeks to integrate a function, specifically f = Integrate[sigma[x]^2, x], while generating random numbers for it. A suggestion is made to use the RandomReal function to generate a large number of random values quickly. However, there is confusion regarding how the time constraint, the integral, and the variable sigma relate to each other and the plotting process. The importance of clear, step-by-step instructions is emphasized, highlighting the need for precise guidance to ensure the desired outcome is achieved without misinterpretation. The discussion underscores the necessity of clarity in mathematical programming tasks to avoid repeated misunderstandings.
sola maths
Messages
8
Reaction score
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


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?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K