Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create the following vectors efficiently using loops (i.e. without vectorization). See if you can find more than 1 solution. (20 pts) (a) A =

image text in transcribed

Create the following vectors efficiently using loops (i.e. without vectorization). See if you can find more than 1 solution. (20 pts) (a) A = [1, 3, 5, 7, 9, ...] up to n = 10 terms. Modify your code to work for n = 100. (b) B = [1, 2, 4, 8, 16, 32, ...] up to n = 10 terms. Modify your code to work for n = 100. (c) C= [1, 0.1, 0.01, 0.001, 0.0001, ...] up to n = 10 terms. Modify your code to work for n = 20. (d) D= [1, -1, 1, -1, 1, -1, ...] up to n = 10 terms. Modify your code to work for n = 100. (e) E= [0, 1/2, 2/3, 3/4, 4/5, 5/6, ...] up to n = 10 terms. Modify your code to work for n = 100.

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

Here are the solutions to create the vectors efficiently using loops Vector A Python def createvectorAn Creates a vector containing the odd numbers from 1 to n A for i in range1 n 1 2 Aappendi return ... 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_2

Step: 3

blur-text-image_3

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions