Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Sep 8, 2012 #1
    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: Sep 8, 2012
  2. jcsd
  3. Sep 10, 2012 #2
    Re: To generate and plot random real numbers in Mathematica within a specified time r

    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?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: To generate and plot random real numbers in Mathematica within a specified time range
  1. Plot in real time (Replies: 9)

Loading...