CODINGLISTINGS ★ Wave Interference ★

Wave Interference (Popular Computing Weekly)Coding Listings
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

Super simulation

Making waves on any Amstrad machine - from the keyboard of John Kennedy

This program simulates the superposition of light - that is the resultant wave formed by two combined incident waves. It should be of interest to physics students as it shows constructive and destructive interference in a simple and easily understood manner. When the program is run, it will ask for some data. The user should enter the wavelength of the two waves, noting that only wavelengths between 1cm and 1m are accepted. The computer will then ask for the wave offset. This is the number of degrees that B is ahead of A, eg 180 is half a wavelength ahead; 90 is a quarter; 0 and 360 will produce a zero offset.

The program will then draw a grid in which each square represents 1 cm and with a horizontal axis across from left to right representing zero displacement. The waves and their resultant will be drawn out in different colours and then made to flash, highlighting the two sets. Pressing space at this point will re-run the program. Some example input data is given above.

Wavelengths Offset Result
8 and 5 180 destructive
5 and 5 0 constructive
5 and 5 90 mixture
2 and 1.5 0 'beats'

Beats are the regular changes in the amplitude of the resultant waves. They can be heard when two sound sources of similar amplitude but slightly different wavelength are used. Even the sound generator of the Amstrad will cause beats, try; Sound 1,1500,30000 followed by Sound 2,1601,30000.

Program Notes

The program has so many REM statements notes are almost unnecessary.

Line

  • 70 If progam broken into, re-run.
  • 150-540 Get data from user.
  • 490-630 Draw grid and axis.
  • 640-770 Draw actual waves.
  • 780-950 Re-run?
  • 960-970 On error routine.

PopularComputingWeekly850502

★ PUBLISHER: POPULAR COMPUTING WEEKLY
★ YEAR: 1985
★ CONFIG: ???
★ LANGUAGE:
★ AUTHOR: John Kennedy
 

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Coding Src's » Graphic - Crtc - On - Screen Effects On the CPC464 (Popular Computing Weekly)
» Coding Src's » Easter Sunday Program (Computing with the Amstrad)
» Coding Src's » Swirl
» Coding Src's » ARTIFICE (CPC Infos)
» Coding Src's » Amstrad abstracts
» Coding Src's » Scroll (Popular Computing Weekly)
Je participe au site:

» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 200 millisecondes et consultée 1689 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.