Home / Expert Answers / Computer Science / python-programming-this-is-a-big-question-with-multiple-little-parts-1-define-two-numpy-arrays-a-pa144

(Solved): python programming ( this is a big question with multiple little parts) 1- Define two numpy arrays a ...



python programming ( this is a big question with multiple little parts)

1-

Define two numpy arrays a and b with five arbitrary numbers.

# YOUR CODE HERE
raise NotImplementedError()

assert len(a) == 5
assert len(b) == 5
assert isinstance(a, np.ndarray)
assert isinstance(b, np.ndarray)

2-

Add the arrays a and b element by element and store the result in the variable c. Perform the calculation analogously for the multiplication and store the result in m.

# YOUR CODE HERE
raise NotImplementedError()

assert isinstance(c, np.ndarray)
assert isinstance(m, np.ndarray)

3- 

Multidimensional arraysAufgabe 2-2: Mehrdimensionale Arrays
Aufgabe: Erzeugen Sie die Matrizen
A = (3-¹) and R=(1²4)
B
als zwei-dimensionales Numpy

Create the matrices:A&B ( you find them in the picture under Aufgabe 2-2)

als zwei-dimensionales Numpy Array und speichern Sie diese in Variablen A und B

# YOUR CODE HERE
raise NotImplementedError()

assert np.shape(A) == (2, 2)
assert np.shape(B) == (2, 2)
assert isinstance(A, np.ndarray)
assert isinstance(B, np.ndarray)

4-

Add the matrices A and B and store the result in the variable C. Perform the calculation analogously for the matrix multiplication ( ????????? ) and store the result in M.

# YOUR CODE HERE
raise NotImplementedError()

assert isinstance(C, np.ndarray)
assert isinstance(M, np.ndarray)
assert np.shape(C) == (2, 2)
assert np.shape(M) == (2, 2)

5-

Eigenvalue decomposition

Perform the eigenvalue decomposition of the matrices A and C. Store the eigenvalues in the variables l_A and l_C, and the eigenvectors in the variables v_A and v_C.

# YOUR CODE HERE
raise NotImplementedError()

# Here the solutions are tested.

6-

Sympy :Sympy lets you perform symbolic computations in Python. Define the functions:

 

????(????)=cos(4????)

????(????)=exp(????)?????^2   , in the variables f and g.

x = sp.Symbol('x')
# YOUR CODE HERE
raise NotImplementedError()

# Here the solutions are tested.

7-

Calculate the root functions of f using integration of Sympy and store them in F.

# YOUR CODE HERE
raise NotImplementedError()

# Here the solutions are tested.

8- 

 Calculate the definite integral

????=?????(????)d???? ( from -5 to 6 ) 

and store the solution in the variable G..

# YOUR CODE HERE
raise NotImplementedError()

# Here the solutions are tested.

9-

Matplotlib

Plot the points (????????,????????) , where ???????? and ???????? are the elements from the arrays a and b, respectively.
On the one hand, the points themselves should be marked, and on the other hand, they should also be connected.
Give the x-axis the label "values from a" and the y-axis the label "values from b".

# YOUR CODE HERE
raise NotImplementedError()

In import numpy as np
import sympy as sp
import matplotlib.pyplot as plt
Aufgabe 2-1: Numpy Arrays
Hinweis: Viele der BefehleAufgabe: Führen Sie die Eigenwertzerlegung der Matrizen A und c durch. Speichern Sie die Eigenwerte in die Variablen 1 A und Aufgabe: Berechnen Sie die Stammfunktionen von mittels Integration von Sympy und speichern Sie diese in F.
In [ ] # YOUR CODE

 

Aufgabe 2-2: Mehrdimensionale Arrays Aufgabe: Erzeugen Sie die Matrizen A = (3-¹) and R=(1²4) B als zwei-dimensionales Numpy Array und speichern Sie diese in Variablen A und B. In [ ]: # YOUR CODE HERE raise NotImplementedError () In [ ]: assert np.shape (A) == (2, 2) assert np.shape (B) == (2, 2) assert isinstance (A, np.ndarray) assert isinstance (B, np.ndarray) Aufgabe: Addieren Sie die Matrizen A und B und speichern Sie das Ergebnis in der Variable c. Führen Sie die Rechnung analog für die Matrix-Multiplikation (A. B) aus und speichern Sie das Ergebnis in M. In [ ]: # YOUR CODE HERE raise NotImplementedError() In assert isinstance (C, np.ndarray) assert isinstance (M, np.ndarray) assert np.shape (C) == (2, 2) assert np.shape (M)=(2, 2) In import numpy as np import sympy as sp import matplotlib.pyplot as plt Aufgabe 2-1: Numpy Arrays Hinweis: Viele der Befehle in numpy haben eine sehr große Ähnlichkeit zu den Befehlen in Matlab. Wenn Sie bereits Erfahrung mit Matlab haben, können Sie Teile Ihres Wissens schnell und einfach übertragen. Aufgabe: Definieren Sie zwei Numpy-Arrays a und mit fünf beliebigen Zahlen. In [ ]: # YOUR CODE HERE raise Not ImplementedError () In assert len (a) == 5 assert len (b) 5 assert isinstance (a, np.ndarray) assert isinstance (b, np.ndarray) Aufgabe: Addieren Sie die Arrays a und belement-weise und speichern Sie das Ergebnis in der Variable c. Führen Sie die Rechnung analog für die Multiplikation aus und speichern Sie das Ergebnis in m. In [ ]: # YOUR CODE HERE raise Not ImplementedError() In [] assert isinstance (c, np.ndarray) assert isinstance (m, np.ndarray) Aufgabe: Führen Sie die Eigenwertzerlegung der Matrizen A und c durch. Speichern Sie die Eigenwerte in die Variablen 1 A und 1_c, sowie die Eigenvektoren in die Variablen v_A und v_c. In [] # YOUR CODE HERE raise NotImplementedError() In [ ]: # Hier werden die Loesungen getestet... Aufgabe 2-4: Sympy Mit Sympy können Sie symbolische Rechnungen in Python ausführen. Aufgabe: Definieren Sie die Funktionen in den Variablen € und g In [ ]: x = sp.Symbol('x') # YOUR CODE HERE raise Not ImplementedError() In [] # Hier werden die Loesungen getestet... f(x) = cos(4x) g(x) = exp(x) = x² Aufgabe: Berechnen Sie die Stammfunktionen von mittels Integration von Sympy und speichern Sie diese in F. In [ ] # YOUR CODE HERE raise NotImplementedError() In [ ]: #Hier werden die Loesungen getestet... Aufgabe: Berechnen Sie das bestimmte Integral = [?²80 und speichern Sie die Lösung in der Variablen G. # YOUR CODE HERE raise NotImplementedError() # Hier werden die Loesungen getestet... Aufgabe 2-5: Matplotlib Aufgabe: Plotten Sie die Punkte (a,, b;), wobei a; und b, die Elemente aus den Arrays a und b sind. Es sollen zum einen die Punkte selbst markiert werden und zum anderen sollen sie zusätzlich miteinander verbunden werden. Geben Sie der X-Achse die Beschriftung "Werte aus a" und der y-Achse die Beschriftung "Werte aus b". In [ ] # YOUR CODE HERE raise NotImplementedError() In [ ]: In [ ]: G = g(x)dx


We have an Answer from Expert

View Expert Answer

Expert Answer


-> CODE import numpy as np import sympy as sp import matplotlib.pyplot as plt # PART-1 a = np.array([1,2,3,4,5]) b = np.array([1.1,2.2,3.3,4.4,5.5]) assert len(a)==5 assert len(b)==5 assert isinstanc
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe