Question

In: Computer Science

please use Jupter notebook in python 3 to answer the following: Plot the hyperbolic paraboloid given...

please use Jupter notebook in python 3 to answer the following:

Plot the hyperbolic paraboloid given by: z = x**2/a**2 - y**2/b**2. You may use any non-negative integer values for a and b.

Solutions

Expert Solution

Code:

import numpy as np
import pptk
def f(x, y):
  return x ** 2 - y ** 2

t = np.linspace(-1.0, 1.0, 100)
x, y = np.meshgrid(t, t)
z = f(x, y)
P = np.stack([x, y, z], axis=-1).reshape(-1, 3)

v = pptk.viewer(P)
v.attributes(P[:, 2])
v.set(point_size=0.005)

(Let me know if Jupyter can't import pptk, I shall give an alternate code then)

Alternate code:

from __future__ import division

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure(figsize=plt.figaspect(1))  # Square figure
ax = fig.add_subplot(111, projection='3d')

r=1;
u=np.linspace(-2,2,200);
v=np.linspace(0,2*np.pi,60);
[u,v]=np.meshgrid(u,v);

a = 1
b = 1

x = a*np.cosh(u)*np.cos(v)
y = b*np.sinh(u)
z = x**2 - y**2

ax.plot_surface(x, y, z,  rstride=4, cstride=4, color='b')

plt.show()


Related Solutions

Create a new Python 3 Jupyter Notebook. At the top, be sure to name your notebook...
Create a new Python 3 Jupyter Notebook. At the top, be sure to name your notebook as "*assignment 2.08 - Your Name Here.ipynb*" (obviously, replace the "Your Name Here" part with your actual name). Create a single python cell to program the following specifications. Use what you've learned on this page to: 1. Find the index of "lmno" in the English alphabet using an appropriate instruction and store it in a variable. (hint: you'll need to define a string that...
I'm stuck on this python exercise using plots Consider the hyperbolic paraboloid function: z=x^2−y^2 Create several...
I'm stuck on this python exercise using plots Consider the hyperbolic paraboloid function: z=x^2−y^2 Create several plots of the hyperbolic paraboloid function. Use true aspect ratio and label all axes. Any help would be appreciated!Matlab can be used as long as the code can be used in Python as well
3. Use matlab to plot the output voltage of an inverting operational amplifier given the following...
3. Use matlab to plot the output voltage of an inverting operational amplifier given the following conditions: K = Gain of the amplifier = 12.5. Vi = input voltage -2.5 < Vi < 2.5 V], (use 0.25 increments). V+ = positive power supply voltage, V+ = +20 V. V- = negative power supply voltage V- = -20V. Vo = output voltage Vo = -KVi Recall that if the output voltage Vo is greater than V+, or less than V-, the...
Create a new Python 3 Jupyter Notebook. Create one python code cell for the problem below....
Create a new Python 3 Jupyter Notebook. Create one python code cell for the problem below. Use any additional variables and comments as needed to program a solution to the corresponding problem. All functions should be defined at the top of the code in alphabetical order. When done, download the ipynb file and submit it to the appropriate dropbox in the course's canvas page. Problem: Define a function with the following characteristics: The function's purpose will be calculating a factORRial...
create a new Python 3 Jupyter Notebook.. Create one python code cell for the problem below....
create a new Python 3 Jupyter Notebook.. Create one python code cell for the problem below. Use any additional variables and comments as needed to program a solution to the corresponding problem. All functions should be defined at the top of the code in alphabetical order. Problem: Define a function with the following characteristics: The function's purpose will be checking that a number matches another, so it should be named appropriately. It must accept one parameter, which is the number...
Use Python 3, please type. Write a Python 3 program which is an arithmetic quiz for...
Use Python 3, please type. Write a Python 3 program which is an arithmetic quiz for children. The program asks the user to calculate the multiplication of two numbers generated at random in your code. The numbers should be in the range 1 through 10. User input is shown in bold black font in the example below. You will need to use random numbers. You should type the recommended comments at the top of your code and include three test...
Please keep it simple for Hyperbolic Geometry (the response I was given was great, but it...
Please keep it simple for Hyperbolic Geometry (the response I was given was great, but it was well beyond what we needed) Illustrate with a picture showing that the following are simply not true in Hyperbolic Geometry c). The angle sum of any triangle is 180 d). Rectangles exist
USE Python 3, please type thanks! Write a Python 3 program to calculate the Body Mass...
USE Python 3, please type thanks! Write a Python 3 program to calculate the Body Mass Index (BMI) of a person if they enter their weight and their height to your program. Check out the formula here: http://www.freebmicalculator.net/calculate-bmi.php Your program should first print "Body Mass Index Calculator" The program will then ask the user if they want to enter Metric Units or English Units. Using the appropriate formula (see link above) calculate their BMI. Depending on their BMI show their...
Please use Python 3 3). Write a function that writes a series of random numbers to...
Please use Python 3 3). Write a function that writes a series of random numbers to a text file named ‘random_number.txt’. Each random number should be in the range of 1 through 500. The function should let the user specify how many random numbers the file will hold. Then write another function that reads the random numbers from the ‘random_number.txt’ file, displays the numbers, and then displays the total of the numbers and the number of random numbers read from...
Please Use Python 3.The Problem: Read the name of a file and then open it for...
Please Use Python 3.The Problem: Read the name of a file and then open it for reading. Read the name of another file and then open it for output. When the program completes, the output file must contain the lines in the input file, but in the reverse order. • Write the input, output, and the relationship between the input and output. • Develop the test data (A single test will be alright). Make the input file at least 3...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT