Sine and cosine functions stand as foundational elements, these functions are synonymous with order and regularity. As I have explored on my previous post complexity introduces a fascinating layer of randomness.
In this visual analysis, I’m going to answer two questions.
- What if we take a random approach to studying these waves? I’ll look at how they behave when combined with randomly selected functions and sign choices. I’ll test this out in lots of scenarios to see what else is revealed and how this compares with the behaviour I described in my last post.
- Could there be something else that the randomness in these functions is showing us? Given how the random functions behave, is there something that’s right or natural for each use case? I’m just running some computational experiments to see if anything interesting comes up.
Let’s start!
Sin and Cos Waves: Traditional behavior
Sin and Cos Waves: Traditional behavior
Plot[{Sin[x],Cos[x]},{x,-10,10},PlotTheme->"Detailed"]
Out[]=
First Analysis: Random function choice with fixed sign
First Analysis: Random function choice with fixed sign
We are going to analyze the behavior of the function
N
∑
i1
Where is the placeholder of the function, and is going to be a Natural or a Real number
ξ
n
Defining the function
Defining the function
Here fun takes two arguments, ξ which is the function, and which is the parameter
n
fun[ξ_Symbol,n_]:=ξ[n*x]
One output
One output
First let’s generate one output, the first is going to be with a natural parameter, and the second, a real parameter
In[]:=
f1={Sum[fun[RandomChoice[{Sin,Cos}],i],{i,5}],Sum[fun[RandomChoice[{Sin,Cos}],Sqrt[i]],{i,5}]};GraphicsRow[Table[Plot[f1[[i]],{x,-10,10},PlotTheme->"Minimal",PlotLabel->f1[[i]]],{i,2}]]
Out[]=
That is an interesting behavior, can you see it? Let’s analyze multiple outputs to see if this persist
Multiple outputs
Multiple outputs
Integer parameter
Integer parameter
In[]:=
f1M=Table[Sum[fun[RandomChoice[{Sin,Cos}],i],{i,5}],{ι,3}];f1M//TableForm//TraditionalFormGraphicsRow[Table[Plot[f1M[[i]],{x,-10,10},PlotTheme->"Minimal"],{i,3}]]
Out[]//TraditionalForm=
sin(x)+sin(4x)+sin(5x)+cos(2x)+cos(3x) |
sin(3x)+sin(4x)+cos(x)+cos(2x)+cos(5x) |
sin(x)+sin(5x)+cos(2x)+cos(3x)+cos(4x) |
Out[]=
Real parameter
Real parameter
In[]:=
f1R=Table[Sum[fun[RandomChoice[{Sin,Cos}],Sqrt[i]],{i,5}],{ι,3}];f1R//TableForm//TraditionalFormGraphicsRow[Table[Plot[f1R[[i]],{x,-10,10},PlotTheme->"Minimal"],{i,3}]]
Out[]//TraditionalForm=
sin( 3 x)+sin(5 x)+cos(x)+cos(2x)+cos(2 x) |
sin(2x)+sin( 3 x)+cos(x)+cos(2 x)+cos(5 x) |
sin(2x)+sin( 2 x)+sin(3 x)+sin(5 x)+cos(x) |
Out[]=
I hope you can see it, let’s analyze:
When is an integer, the plot of the function, despite the presence of a random factor, exhibits periodicity and a consistent behavioral pattern. However, when is a real number, the behavior becomes more sporadic and erratic.
n
n
I stand by what I wrote: if randomness had something hidden, I meant it!
Second Analysis: Random Function Choice with Alternate Sign
Second Analysis: Random Function Choice with Alternate Sign
We are going to analyze the behavior of the function
N
∑
i1
i
(-1)
Where is the placeholder of the function, and is going to be a Natural or a Real number
ξ
n
One output
One output
In[]:=
f2=Sumfun[RandomChoice[{Sin,Cos}],i],{i,5},Sumfun[RandomChoice[{Sin,Cos}],Sqrt[i]],{i,5};GraphicsRow[Table[Plot[f2[[i]],{x,-10,10},PlotTheme->"Minimal",PlotLabel->f2[[i]]],{i,2}]]
i
(-1)
i
(-1)
Out[]=
Multiple outputs
Multiple outputs
Integer parameter
Integer parameter
In[]:=
f2M=TableSumfun[RandomChoice[{Sin,Cos}],i],{i,5},{ι,3};f2M//TableForm//TraditionalFormGraphicsRow[Table[Plot[f2M[[i]],{x,-10,10},PlotTheme->"Minimal"],{i,3}]]
i
(-1)
Out[]//TraditionalForm=
-sin(3x)-sin(5x)-cos(x)+cos(2x)+cos(4x) |
-sin(x)+sin(4x)+cos(2x)-cos(3x)-cos(5x) |
-sin(x)+sin(2x)+sin(4x)-sin(5x)-cos(3x) |
Out[]=
Real parameter
Real parameter
In[]:=
f2R=TableSumfun[RandomChoice[{Sin,Cos}],Sqrt[i]],{i,5},{ι,3};f2R//TableForm//TraditionalFormGraphicsRow[Table[Plot[f2R[[i]],{x,-10,10},PlotTheme->"Minimal"],{i,3}]]
i
(-1)
Out[]//TraditionalForm=
sin(2x)-sin( 3 x)-sin(5 x)-cos(x)+cos(2 x) |
-sin(x)+sin( 2 x)-sin(5 x)+cos(2x)-cos(3 x) |
sin( 2 x)-sin(3 x)-sin(5 x)-cos(x)+cos(2x) |
Out[]=
As we can clearly see, the same behavior is at play here. It is fascinating to observe that when is an integer, it exhibits periodic behavior even when there is an additional random component, namely the sign. When is a real, the behavior is identical to that observed in the previous case. While the behavior may be slightly less regular, it nevertheless retains the same underlying structure.
n
n
Third Analysis: Random function choice with random sign
Third Analysis: Random function choice with random sign
We are going to analyze the behavior of the function
Defining the function
Defining the function
One output
One output
Multiple parameters
Multiple parameters
Integer parameter
Integer parameter
Real parameter
Real parameter
One might inquire as to the rationale behind this observed behavior. Based on the available evidence, it would be reasonable to hypothesize that the behavior would manifest in a more discrete manner, given that the factor in question, namely the square root, is less than the integer number. This hypothesis is supported by the following table.
One might initially hypothesise that the randomness is introduced through the square root, and then amplified by the sine or cosine functions. .
◼
This could be a fruitful hypothesis, and an intriguing topic for future study, namely how the randomness is distributed or eliminated by specific functions
It would be prudent to ascertain the veracity of this assertion. To this end, we shall examine the following table, wherein the variable “n” is an integer and not a real number.
It is evident that the outcome exhibits a degree of randomness. What is the rationale behind the prevalence of positive behaviour and symmetry when n is an integer? Once more, this is an intriguing phenomenon that I observed while conducting these visualisations.
Conclusion
Conclusion
In the present study, three cases were examined. Despite the differing levels of randomness, the behaviour exhibited was found to be remarkably similar. This behaviour can be summarised as follows:
This presents a summary of the findings I have made thus far. It may prove beneficial to pursue further investigation by applying this same analytical approach to functions exhibiting disparate behavioural characteristics, with a view to understanding the manner in which randomness manifests.
We must now address the main question: why was it? I believe this is a crucial topic for discussion and exploration.
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
A visual analysis of sine and cosine waves behavior with random function selection and sign choice
by Jesús Adrián Montesinos Correa
Wolfram Community, STAFF PICKS, November 2, 2024
https://community.wolfram.com/groups/-/m/t/3313387
by Jesús Adrián Montesinos Correa
Wolfram Community, STAFF PICKS, November 2, 2024
https://community.wolfram.com/groups/-/m/t/3313387