Sine wave equation into Java Code

In summary, the Wave equation is implemented in Java using variables for amplitude (A), wavelength (L), spatial and temporal angular frequencies (w and wt), speed (s), direction (d), and initiatory phase (FI). The formula Y(x,y,t) = A*cos(w*(x,y) + wt*t + FI) returns a vector. The section "w * (x, y)" appears to be the scalar product of w and a 2D vector (x,y), representing the wavenumber in the x and y directions. The exact details of how this is used are unclear. For more information, please refer to the source provided.
  • #1
TastyLemons
3
0
I have been trying to implement this Wave equation into java:

A = amplitude of wave
L = wave length
w = spatial angular frequency
s = speed
wt = temporal angular frequency
d = direction
FI = initiatory phase

Y(x,y,t)=A*cos(w *(x,y)+ wt*t + FI;

I understand that it returns a Vector. But i am unsure as to what this section of the formula means:

w *(x,y)

I believe that w is a vector. But I am not whether its a 3d Vector or 2d Vector, and how it is used.
If you have time, could you please explain this formula to me? Thank you

Source:
http://lnu.diva-portal.org/smash/get/diva2:205412/FULLTEXT01

Thank You!
 
Technology news on Phys.org
  • #2
TastyLemons said:
I have been trying to implement this Wave equation into java:

A = amplitude of wave
L = wave length
w = spatial angular frequency
s = speed
wt = temporal angular frequency
d = direction
FI = initiatory phase

Y(x,y,t)=A*cos(w *(x,y)+ wt*t + FI);

Added missing bracket.

I understand that it returns a Vector. But i am unsure as to what this section of the formula means:

w *(x,y)

I believe that w is a vector. But I am not whether its a 3d Vector or 2d Vector, and how it is used.
If you have time, could you please explain this formula to me? Thank you

Source:
http://lnu.diva-portal.org/smash/get/diva2:205412/FULLTEXT01

Thank You!

So far as I can tell, [itex]w[/itex] is the wavenumber and is a 2D vector, and "w * (x, y)" is the scalar product [itex]\vec w \cdot (x,y)[/itex].
 

1. What is a sine wave equation?

A sine wave equation is a mathematical formula that represents a smooth oscillating curve. In its simplest form, it is written as y = A sin(Bx + C), where A is the amplitude, B is the frequency, and C is the phase shift.

2. Why is it important to convert the sine wave equation into Java code?

Converting the sine wave equation into Java code allows us to use the equation in programming applications. This can be useful for creating visualizations, simulations, or other tools that involve the use of sine waves.

3. How can I write the sine wave equation in Java code?

To write the sine wave equation in Java code, you can use the Math.sin() method. For example, if you want to create a sine wave with an amplitude of 1, frequency of 2, and phase shift of 0, you would use the code: double y = Math.sin(2 * Math.PI * x + 0);

4. Can the sine wave equation be modified in Java code?

Yes, the sine wave equation can be modified in Java code by changing the values of A, B, and C. This will result in changes to the amplitude, frequency, and phase shift of the sine wave.

5. Are there any limitations to using the sine wave equation in Java code?

The main limitation of using the sine wave equation in Java code is that it only represents a single oscillating curve. Other equations, such as the cosine wave equation, may need to be used to create more complex patterns or simulations.

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
Replies
5
Views
808
Replies
4
Views
918
Replies
78
Views
3K
  • Programming and Computer Science
Replies
7
Views
2K
  • Classical Physics
Replies
7
Views
1K
  • Classical Physics
Replies
2
Views
898
  • Classical Physics
Replies
2
Views
729
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
Back
Top