Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question is a generalization of the previous question that you completed using the workspace. Note that the two questions are independent, and any of

This question is a generalization of the previous question that you completed using the workspace. Note
that the two questions are independent, and any of the variables defined before will not be carried over (this
is the case for ALL PrairieLearn questions due to the way the system is designed).
Use the knowledge that you obtained in the previous question to write a function with the following
signature:
def investment(p1,p2,p3, assets, t :
# write your code here
return value
Your code snippet needs to define the function investment that will take as arguments three 1d numpy
arrays p1,p2 and p3 with same size, a tuple assets and an integer t.
The numpy arrays contain the history of stock prices for the three companies.
The tuple assets has three entries, where each entry correponds to the number of assets for the companies
with stock prices p1,p2 and p3 respectively.
The integer t is the time where we want you to compute the value of your investment which will be the
ouput of the function investment. The variable t varies from to len(p1)-1.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

Students also viewed these Databases questions

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago

Question

a. How are members selected to join the team?

Answered: 1 week ago

Question

b. Will new members be welcomed?

Answered: 1 week ago

Question

c. Will leaders rotate periodically?

Answered: 1 week ago