首页 > > 详细

代写Investment Modeling Spring 2019, Practice Set # 4代做留学生Matlab编程

项目预算:   开发周期:  发布时间:   要求地区:

Investment Modeling Spring 2019, Practice Set # 4

Use the code below to answer questions # 1-5.

library (data .table)

M3=data .frame (x=1:5,y=seq (2,10,2),z=7:3)

setDT(M3)

1. What is sum(M3[,3])?

2. What is sum(M3[,2])?

3. What is sum(M3+rep(2,5))?

4. What is M3[y¡6,x]?

5. What is sum(M3[,2]+M3[,x])?

Use the code below to answer questions # 6-7.

giants=c (2:5)

cowboys=rep (3,4)

eagles=c (6: giants[cowboys [2]])

6. What is x?

x= sum ( sum (giants)*eagles)

7. What is x?

x= sum (giants + c (eagles , cowboys[giants [1]]))

8. What is a?

a = 6:1

a[c (2,4)]= c (10,20)

9. What is a?

a = 6:1

a[2:4]=rep (2,3)

10. What is mm?

mm = c (1:9)

mm[2:4]= c (12,13,14)

11. What is mm?

mm = c (1:9)

mm[c (7,3:2)]= c (20,40,60)

12. Given the code below, what is a?

z = 3:1

a=0 for (i in z) { a=a-i }

13. Given the code below, what is b?

x = 1:4

b=c (2,4,6,8)

for (i in x)

{

if ((i/2) >3)

{

b[NROW (b)]=i/2

}

else

{

b[(i/2)+2*i]=i/2

}

}

Use the table mdf below to answer questions from #14-19.

Ticker

Date

TotalAssets

TotalDebt

Price

FB

201703

150

30

4

FB

201706

100

25

1

FB

201709

500

100

3

FB

201712

100

20

5

AAPL

201703

200

100

2

AAPL

201706

150

30

4

AAPL

201709

300

15

6

AAPL

201712

100

10

8

TSLA

201703

250

50

4

TSLA

201706

200

40

10

TSLA

201709

350

70

6

TSLA

201712

150

50

5

14. Given the code below, what is tt?

z = 1:4

tt=head(mdf$Price ,5)

r=seq (2,10,2)

for (i in z)

{

for (x in r[c (1,3,5)])

{

tt[NROW (r)]=i+x

}

}

15. Given the code below, what is b?

v = head(mdf$Price ,9)

z = tail(v,5)

b=c ()

for (i in z)

{

if ((i -1) >=3 && (i-4) <=3)

{

b[NROW (b)+1]=i

}

else

{

b=c (b,i)

}

}

16. Given the code below, what is v?

v = c (2,4,10,5,2,8,12)

z=seq (2,12,mdf[Ticker== ’AAPL & Date==201703, Price])

v[c (2:3,6)]=z[c (1,4:5)]

17. Given the code below, what is v?

stock=head(mdf ,4)

stockc = stock[,Price]

ret=c ()

for (i in 1:(NROW (stockc) -1))

{

ret[i]=(stockc[i+1] + stockc[i]) - 1

}

v=ret[1]


软件开发、广告设计客服
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 9951568
© 2021 www.rj363.com
软件定制开发网!