You draw sin-wave and cos-wave in your simulation.
I did not find you try to draw the visual representation for Longtinual Wave.
It is easier to draw visual representation for transverse wave.
Because the y-offset is the same, the displacement is proportion to either sin/cos function.
However, the mathematic calculation is a little more complicate if you want to draw visual representation for Longtinual Wave.
May be you are confused between wave function and visualization of wave motion.