NumPy: Multiply a matrix by another matrix of complex numbers and create a new matrix of complex numbers
NumPy Mathematics: Exercise-12 with Solution
Write a NumPy program to multiply a matrix by another matrix of complex numbers and create a new matrix of complex numbers.
import numpy as np x = np.array([1+2j,3+4j]) print("First array:") print(x) y = np.array([5+6j,7+8j]) print("Second array:") print(y) z = np.vdot(x, y) print("Product of above two arrays:") print(z)
First array: [ 1.+2.j 3.+4.j] Second array: [ 5.+6.j 7.+8.j] Product of above two arrays: (70-8j)
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
Test your Python skills with w3resource's quiz
Python: Tips of the Day
Getting rid of unwanted characters:
You can get rid of whitespaces or any specific character using strip methods in Python. You can use either plain strip for both sides, lstrip for the left side and rstrip for the right side only.
str="+++Welcome python+++" str.strip() print(str)
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework