Generating Irrational Ratios in Wave Simulations

In summary, the conversation discusses the challenge of generating two random numbers whose ratio appears to be irrational in a simulation. One suggestion is to use a large prime number as one of the numbers to achieve a very long repeat period. Another suggestion is to start with a random ratio and back-calculate one of the initial numbers. The importance of the ratio being close to 1 is also discussed, as well as the potential for aperiodic behavior in the combined signal. The conversation concludes with a suggestion to focus on the overall purpose of the simulation.
  • #1
roam
1,271
12
TL;DR Summary
Is there a way to generate two random numbers such that their ratio simulates the behavior of an irrational number?
I am trying to write an algorithm that generates two random numbers in a given interval such that their ratio is an irrational number. I understand that all numbers stored on a computer are rational, so it is not possible to have a truly irrational number in a simulation. So, instead I am looking for an algorithm that generates two numbers whose ratio simply has a very long repeat period (it appears to be irrational during the simulation). How would such an algorithm look like (e.g., in Matlab)?

Any suggestions would be greatly appreciated.

P.S. I am simulating a physical situation where the ratio of the period of two waves is not rational (or rather, it has a very long repeat period), hence the resultant wave does not appear to be periodic.
 
Mathematics news on Phys.org
  • #2
Any two (pseudo) random numbers to a reasonable level of precision would do - what happens when you try?
 
  • Like
Likes roam
  • #3
Hi @pbuk

I modified my code, so that one of the numbers is always a large prime, so that the ratio of the two numbers will have a very long repeat period. However, as a double precision number, the number will still only have 16 significant digits.

Also, I believe the problem with my simulation might be something else. The two numbers that I am generating must be close in range, e.g., if they are both primes we might get:

##x_1 = 2051587##
##x_2 = 2051773##

Note that ##x_1## and ##x_2## represent periods of waves that I am trying to combine.

So, the ratio of the above numbers will be either 1.000090661522032 or 0.999909346696735. I think, that means that the two waves will be effectively in phase, and you will only see aperiodic behavior if you plot for an extremely large number of cycles. Is that right?

Any explanation would be appreciated.
 
  • #4
I suggest starting with a random number for the ratio and back-calculating one of the initial numbers that you talked about. That allows you to control the ratio and know that it is what you want (very long repeating period, magnitude, etc.)
 
  • #5
Hi @FactChecker

Do you think that would still be helpful if the ratio is of the order 1.00009?

If we have a ratio like that, doesn't it mean that the combined signal will still look periodic in the short range? I think one has to simulate over a very large number of periods to see any aperiodicity.
 
  • #6
I don't know what your application is, but generating a random number in the range 0.999998 to 1.00009 is not difficult. Either approach should have a very long repetition period.
 
  • #7
roam said:
So, the ratio of the above numbers will be either 1.000090661522032 or 0.999909346696735. I think, that means that the two waves will be effectively in phase, and you will only see aperiodic behavior if you plot for an extremely large number of cycles. Is that right?

Any explanation would be appreciated.
I'm not sure what aperiodic behaviour looks like, but if you mean that the combination of two waves with similar frequencies is a waveform with a pattern that only changes very slowly then that is correct. What did you expect? I think you need to look at why you are doing what you are doing because you seem to be focussing on unimportant or even meaningless things and ignoring the big picture.
 
  • Like
Likes roam

What is the purpose of simulating irrational numbers?

The purpose of simulating irrational numbers is to represent these numbers in a way that can be easily understood and manipulated by computers. Since irrational numbers cannot be expressed as a finite decimal or fraction, they cannot be accurately represented by computers. Simulating them allows for calculations and operations involving irrational numbers to be performed.

How are irrational numbers typically simulated?

Irrational numbers are typically simulated using algorithms that approximate their values. These algorithms involve a series of calculations and iterations that produce a close approximation of the irrational number. The more iterations that are performed, the more accurate the simulation will be.

What are some common methods for simulating irrational numbers?

Some common methods for simulating irrational numbers include the Newton's method, the bisection method, and the continued fraction method. Each of these methods has its own advantages and disadvantages, and the choice of method often depends on the specific application or problem being solved.

What are the limitations of simulating irrational numbers?

Simulating irrational numbers is not a perfect process and there are limitations to the accuracy of the simulation. The accuracy of the simulation depends on the chosen method and the number of iterations performed. Additionally, the representation of irrational numbers in a computer is always an approximation and can never be exact.

How are simulated irrational numbers used in scientific research?

Simulated irrational numbers are used in various fields of science, such as physics, engineering, and computer science. They are particularly useful in simulations and modeling, where the values of irrational numbers are needed for accurate predictions and calculations. They are also used in algorithms and programs that involve complex mathematical operations.

Similar threads

Replies
2
Views
1K
Replies
3
Views
262
  • Atomic and Condensed Matter
Replies
5
Views
2K
Replies
25
Views
3K
  • General Math
2
Replies
39
Views
5K
  • Programming and Computer Science
Replies
1
Views
635
Replies
5
Views
416
  • General Math
Replies
5
Views
7K
  • Programming and Computer Science
Replies
14
Views
2K
Back
Top