Question: Python matplotlib Interference occurs when two (or more) waves originating from different positions meet each other, their relative phase depending on the position where they

Python matplotlib

Python matplotlib Interference occurs when two (or more) waves originating from different

Interference occurs when two (or more) waves originating from different positions meet each other, their relative phase depending on the position where they meet. In this exercise, you will display two grayscale maps of the interference of two waves originating from point sources: one displaying the height of the sum of the waves, and the other displaying the square of the sum (thereby distinguishing crests from nodes). Define two linspaces (x and y) and use the following lambda function. def source (dist): Takes a single float: dist (x-displacement of source) Outputs a function that takes two values (x, y) - can be int, float, array- and outputs a float or array containing wave heights depending on (x, y) SC - lambda x, y: np.cos (np.sqrt ((x - dist) ** 2 + y ** 2)) return sc How do we get an array containing our function values out of source? Add two sources together, located in different places (dist). Store the sum in a variable A. (Make sure that the type of A is an array!) Store the square of this sum in another variable B. Create a figure with two subplots. Plot A and B as heat maps. To find out how to do this, look at the matplotlib documentation for imshow. To get a good image, you may need to change the limits of your linspaces, place the sources closer or further apart. Play around with it until you get a nice image. Name the subplots. Interference occurs when two (or more) waves originating from different positions meet each other, their relative phase depending on the position where they meet. In this exercise, you will display two grayscale maps of the interference of two waves originating from point sources: one displaying the height of the sum of the waves, and the other displaying the square of the sum (thereby distinguishing crests from nodes). Define two linspaces (x and y) and use the following lambda function. def source (dist): Takes a single float: dist (x-displacement of source) Outputs a function that takes two values (x, y) - can be int, float, array- and outputs a float or array containing wave heights depending on (x, y) SC - lambda x, y: np.cos (np.sqrt ((x - dist) ** 2 + y ** 2)) return sc How do we get an array containing our function values out of source? Add two sources together, located in different places (dist). Store the sum in a variable A. (Make sure that the type of A is an array!) Store the square of this sum in another variable B. Create a figure with two subplots. Plot A and B as heat maps. To find out how to do this, look at the matplotlib documentation for imshow. To get a good image, you may need to change the limits of your linspaces, place the sources closer or further apart. Play around with it until you get a nice image. Name the subplots

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!