Question

Make a matrix which has dimension [0.04:0.01:0.53] as first column, the volume Vsphere = as second...

Make a matrix which has dimension [0.04:0.01:0.53] as first column, the volume Vsphere = as second column, volume Vcube = as the third column, the difference = (Vsphere Vcube) as the fourth column. Make a plot between Vsphere and L, Vcube and L, and difference and L. Note: You must use for loop

Homework Answers

Answer #1
import numpy as np
import matplotlib.pyplot as plt
import math

matrix=np.zeros([3,4])
matrix[:,0]=[0.04,0.01,0.53]

for i in range(3):
    matrix[i,1]=(3*math.pi*(matrix[i,0]**3))/4
    matrix[i,2]=matrix[i,0]**3
    matrix[i,3]=matrix[i,1]-matrix[i,2]
print(matrix)

for i in range (3):
    temp=131+i
    plt.subplot(temp)
    plt.scatter(matrix[:,0],matrix[:,i],label= "stars", color= "green",marker= "*", s=30)
    plt.xlabel('dimensions')
    plt.ylabel('result') 
    plt.legend() 

plt.show(   )
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
a. If variance of asset A is 0.04 and variance of asset B is 0.02, what...
a. If variance of asset A is 0.04 and variance of asset B is 0.02, what is the correlation between the two assets? Assume covariance between the 2 assets to be 0.015. Show how you found the values. b. Suppose a portfolio has expected return of 15% and volatility of 30%. How can you combine this portfolio with the risk-free asset to create a portfolio with 10% expected return? Risk-free asset has expected return of 3%.  Show how you found the...
Prove that for a square n ×n matrix A, Ax = b (1) has one and...
Prove that for a square n ×n matrix A, Ax = b (1) has one and only one solution if and only if A is invertible; i.e., that there exists a matrix n ×n matrix B such that AB = I = B A. NOTE 01: The statement or theorem is of the form P iff Q, where P is the statement “Equation (1) has a unique solution” and Q is the statement “The matrix A is invertible”. This means...
PLEASE USE MAT LAB ONLY. THANK YOU (a) Create and plot the signals listed below and...
PLEASE USE MAT LAB ONLY. THANK YOU (a) Create and plot the signals listed below and save your Matlab code in a script file. i) Cosine signal of frequency 100 Hz over the range [0,0.1] seconds and samples spaced 10^- 4 seconds apart with a phase of pi/2 and an amplitude of 1.   PLEASE USE MAT LAB ONLY. THANK YOU ii) A square wave that oscillates between 0 and 1 every five samples, plot 3 periods of the waveform. iii)...
A pharmaceutical company has developed a drug that is expected to reduce hunger. To test the...
A pharmaceutical company has developed a drug that is expected to reduce hunger. To test the drug, three samples of rats are selected with n=12 in each sample. The first sample receives the drug every day. The second sample is given the drug once a week, and the third sample receives no drug at all (the control group). The dependent variables is the amount of food eaten by each rat over a 1-month period. These data are analyzed by an...
The government has a bond pays annual coupons of 5 which have a nominal value of...
The government has a bond pays annual coupons of 5 which have a nominal value of 100. The bond matures in three years. The interest rate for the first year is 4.00%, the interest rate for the second year is 4.50% and the interest rate for the third year is 5.82%. simple interest rates should be used to solve this problem. 1. Firstly, you have to calculate the value of the bond ? 2. Secondly, is it necessary to find...
• First, create a function called addNumber, which has a formal parameter for an array of...
• First, create a function called addNumber, which has a formal parameter for an array of integers and increase the value of each array element by a random integer number between 1 to 10. o Add any other formal parameters that are needed. • Second, create another function called printReverse that prints this array in reverse order. • Then, you need to write a C++ program to test the use of these two functions.
he figure below shows the payoff matrix for two firms, Firm 1 and Firm 2, selecting...
he figure below shows the payoff matrix for two firms, Firm 1 and Firm 2, selecting an advertising budget.  For each cell, the first coordinate represents Firm 1's payoff and the second coordinate represents Firm 2's payoff. The firms must choose between a high, medium, or low budget. Payoff Matrix Firm 1 High Medium Low Firm 2 High (0,0) (5,5) (15,10) Medium (5,5) (10,10) (5,15) Low (10,15) (15,5) (20,20) Use the figure to answer the following questions. Note: you only need...
One of the large photocopiers used by a printing company has a number of special functions...
One of the large photocopiers used by a printing company has a number of special functions unique to that particular model. This photocopier generally performs well but, because of the complexity of its design and the frequency of usage, it occasionally breaks down. The department has kept records of the number of breakdowns per month over the last fifty months. The data is summarized in the table below:    Number of Breakdowns Probability 0 0.12 1 0.32 2 0.24 3...
One of the large photocopiers used by a printing company has a number of special functions...
One of the large photocopiers used by a printing company has a number of special functions unique to that particular model. This photocopier generally performs well but, because of the complexity of its design and the frequency of usage, it occasionally breaks down. The department has kept records of the number of breakdowns per month over the last fifty months. The data is summarized in the table below:    Number of Breakdowns Probability 0 0.12 1 0.32 2 0.24 3...
ECO 251: Question Pool STUDY GUIDE Assume that each firm faces perfect competition and wishes to...
ECO 251: Question Pool STUDY GUIDE Assume that each firm faces perfect competition and wishes to maximize profits. Each firm operates in a constant-cost industry unless otherwise stated. 1.   Regarding Hershey’s Kisses, the marginal utility is the __________ satisfaction gained by eating _____________ A.   total, all of the available Kisses. B.   total, the last Kiss. C.   additional, one more Kiss. D.   additional, all of the available Kisses. 2.   A household’s income is spent on two goods, X and Y. If...