Write a program to find the dot product of the given vectors.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
/sites/Sem1 20202021 TK1114 Lab IT1IT2/Shared%20Documents/General/LabFinal(Taksir).
E D Page view A Read aloud I
Input Standard Input
Output Standard Output
Topic Medium Problem
Marks 6
Problem Description
The dot product is an algebraic operation that takes two equal-length sequences of numbers
(usually coordinate vectors) and returns a single number.
The dot product of two vectors a = [a , a2, ..., an ] and b = [bi , b2, ..., bn ] is defined as:
a.b =
aibı + azb2 +...+ anbn
where E denotes summation and n is the dimension of the vector space. For instance, in three-
dimensional space, the dot product of vectors [1, 3, -5] and [4, -2,-1] is:
[1,3, -5] [4,-2,-1] = (1 x 4) + (3 x -2) + (-5 x -1)
= 4 – 6+ 5
= 3
Write a program to find the dot product of the given vectors.
Input
First line of input is an integer N (1<N< 20) in a single line that represents the set size. For
each of the following two lines there will be N integers representing data in set A and B
respectively.
Output
The output displays the dot product for the input.
Sample Input Output
Sample Input
Sample Output
3.
3.
13 -5
4-2 -1
EPIC
Transcribed Image Text:/sites/Sem1 20202021 TK1114 Lab IT1IT2/Shared%20Documents/General/LabFinal(Taksir). E D Page view A Read aloud I Input Standard Input Output Standard Output Topic Medium Problem Marks 6 Problem Description The dot product is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors) and returns a single number. The dot product of two vectors a = [a , a2, ..., an ] and b = [bi , b2, ..., bn ] is defined as: a.b = aibı + azb2 +...+ anbn where E denotes summation and n is the dimension of the vector space. For instance, in three- dimensional space, the dot product of vectors [1, 3, -5] and [4, -2,-1] is: [1,3, -5] [4,-2,-1] = (1 x 4) + (3 x -2) + (-5 x -1) = 4 – 6+ 5 = 3 Write a program to find the dot product of the given vectors. Input First line of input is an integer N (1<N< 20) in a single line that represents the set size. For each of the following two lines there will be N integers representing data in set A and B respectively. Output The output displays the dot product for the input. Sample Input Output Sample Input Sample Output 3. 3. 13 -5 4-2 -1 EPIC
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Matrix multiplication
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education