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...
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.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...
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 give me an example of how we import stock data in jupyter notebook(Python) and analyze...
Please give me an example of how we import stock data in jupyter notebook(Python) and analyze each step.
Write a Python program for the following: A given author will use roughly use the same...
Write a Python program for the following: A given author will use roughly use the same proportion of, say, four-letter words in something she writes this year as she did in whatever she wrote last year. The same holds true for words of any length. BUT, the proportion of four-letter words that Author A consistently uses will very likely be different than the proportion of four-letter words that Author B uses. Theoretically, then, authorship controversies can sometimes be resolved by...
1. Please use Python 3 programing. 2. Please share your code. 3. Please show all outputs....
1. Please use Python 3 programing. 2. Please share your code. 3. Please show all outputs. Create a GUI Calculator with the following: Title : Calculator Label and Entry box for 1st Number Label and Entry box for 2nd Number Buttons for *, /, +, - Label for result and Displaying the result
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT