Question

In: Computer Science

Using Python math functions that produce x,y values. The results of these function calls will be...

Using Python math functions that produce x,y values. The results of these function calls will be used as input to another program of your choice for plotting the results. Plots can be completed using Excel any other online or other graphing tool you have available. Use standard I/O The Math functions and values range of x-values are described below: a. Generate x, sin(x) for x values ranging from -2PI -> 2PI with an increment of PI/64 b. Generate x, cos(x) for x values ranging from -2PI -> 2PI with an increment of PI/64 c. Generate x, sqrt(x) for x values ranging from 0 -> 200 with an increment of 0.5 d. Generate x, log10(x) for x values ranging from 0 -> 200 with an increment of 0.5

Solutions

Expert Solution

import math

x_sinx=[]#list to store x [-2pi,pi]
sinx=[]#list to store sin(x)
a=-2*math.pi
b=2*math.pi
while a<=b:
x_sinx.append(a)
sinx.append(math.sin(a))
a=a+math.pi/64

x_cosx=[]#list to store x [-2pi,pi]
cosx=[]#list to store cos(x)
a=-2*math.pi
b=2*math.pi
while a<=b:
x_cosx.append(a)
cosx.append(math.cos(a))
a=a+math.pi/64

x_sqrt=[]#list to store x [0,200]
sqrtx=[]#list to store sqrt(x)
a=0
b=200
while a<=b:
x_sqrt.append(a)
sqrtx.append(math.sqrt(a))
a=a+.5

x_log10=[]#list to store x [0,200]
log10x=[]#list to store log10(x)
a=0.5#log doesnt exist for 0
b=200
while a<=b:
x_log10.append(a)
log10x.append(math.log(a,10))
a=a+.5


Related Solutions

Write a python function that accepts two integer values corresponding to the point (x, y). Check...
Write a python function that accepts two integer values corresponding to the point (x, y). Check whether the point is within the rectangle centered at (0, 0) with width 20 and height 15. For example, (-9, 7) is inside the rectangle and (11, 4) is outside the rectangle, as shown in the figure. Return True if the point falls within the rectangle and False otherwise
Using Python write a function that implements the following two-dimensional objective function: F (x, y) =...
Using Python write a function that implements the following two-dimensional objective function: F (x, y) = (x^2 + y − 11)^2 + (x + y^2 − 7 )^22 . Determine how many local minimums and maximums and their location for this objective function.
olve the following Math model graphically: X: # of tables to produce Y: # of chairs...
olve the following Math model graphically: X: # of tables to produce Y: # of chairs to produce Max Z = OMR 300 X + OMR 500 Y Subject to: X <= 4 Y <= 6 3x + 2Y <= 18
Consider the system x'= -y , y' = -x Sketch the vector field using math-lab. Please...
Consider the system x'= -y , y' = -x Sketch the vector field using math-lab. Please write the code with all the steps. I'm new on math-lab, and I tried to follow some online videos but it did not work right. I have the sketch, but I need the code and the steps to learn it. Thank you,
All functions are written in python Write a function cube_evens_lc(values) that takes as input a list...
All functions are written in python Write a function cube_evens_lc(values) that takes as input a list of numbers called values, and that uses a list comprehension to create and return a list containing the cubes of the even numbers in values (i.e., the even numbers raised to the third power). For example: >>> cube_evens_lc([2, 5, 6, 4, 1]) result: [8, 216, 64] This version of the function may not use recursion. Write a function cube_evens_rec(values) that takes as input a...
Find the minimum and maximum values of the function f(x,y)=x^2 -y^2 with the restriction, x^2 +y^4 =16, using Lagrange multipliers.
Find the minimum and maximum values of the function f(x,y)=x^2 -y^2 with the restriction, x^2 +y^4 =16, using Lagrange multipliers.
For a demand function u (x, y) = xy, show the demand functions for good x...
For a demand function u (x, y) = xy, show the demand functions for good x and good y. (Remember that MRS = (du/dx) / (du/dy) = px / py in the point of interest, the tangency point of budget line and indifference curve. The budget condition is given by pxx + pyy = m) for u (x, y) = x1/3 y2/3
Integrate the following values of y from x = 0 to x = 130 using (a)...
Integrate the following values of y from x = 0 to x = 130 using (a) The midpoint rule using intervals of [0 10], [10 30], [30 70], and [70 130] (b) The trapezoid rule using the same intervals (c) Simpson’s rule using the same intervals x y 0 6 5 12 10 18 20 30 30 42 50 36 70 24 100 18 130 6 Integrate the differential equation dydt = y from t = 0 to t =...
USING PYTHON 3.7 AND USING def functions. Write a function called GPA that calculates your grade...
USING PYTHON 3.7 AND USING def functions. Write a function called GPA that calculates your grade point average (GPA) on a scale of 0 to 4 where A = 4, B = 3, C = 2, D = 1, and F = 0. Your function should take as input two lists. One list contains the grades received in each course, and the second list contains the corresponding credit hours for each course. The output should be the calculated GPA. To...
Let u(x, y) be the harmonic function in the unit disk with the boundary values u(x,...
Let u(x, y) be the harmonic function in the unit disk with the boundary values u(x, y) = x^2 on {x^2 + y^2 = 1}. Find its Rayleigh–Ritz approximation of the form x^2 +C1*(1−x^2 −y^2).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT