Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a python code to perform the following tasks: 1. create a numpy matrix a of dimension 5 x 5 with diagnol entries from 0

Write a python code to perform the following tasks:

1. create a numpy matrix a of dimension 5 x 5 with diagnol entries from 0 to 4 using a single line of python

2. multiply (matrix-vector operation) this matric by a numpy array b with entries b[j] = (2^j)+j, j = 0,....,4, such that c = a * b

3. implement the same multiplication with a for loop and check your previous result

4. multiply elementwise the resulting array c by the numpy array d with components d[j] = j + [j*3.1654], j = 0,...,4. Use typecast to implement the operation [ . ]. This is the floor operation which return the integer part of any floating point number.

5. Sum all the components of the resulting array except the last one, using a single line of python code

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

=+management system of the MNE?

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago