Operands could not be broadcast together with shapes
Verfasst: Dienstag 28. April 2015, 17:04
Ich habe folgenden Code:
Was kann ich tun? Was mache ich falsch? Error: operands could not be broadcast together with shapes (2,) (131,) . Am Ende hätte ich gerne ein plot (kq, Gdd) - mit zwei funktionen. Ich benutze oben ein array, weil der erste Graph D=2 und kdd=1 haben soll, die zweite Kurve im gleichen Graph soltle D=3 und kdd=4 haben (natürlich mit den richtigen Potenzen). Was mache ich also falsch?
PS! Plotten schaffe ich wahrscheinlich schon. Wäre da nur nicht der Error. Danke im Voraus!
Code: Alles auswählen
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
RT=8.3144621 #J/K/mol
pi=3.1415926535
Na=6.022e23 #1/mol
r=6*10**(-10) #m
D=np.array([2, 3])*10**(-9) #m2/s
kdd=np.array([1, 4])*10**(11) #1/s
Get=10e3 #J/mol
Gdd=np.arange(-100, 30+1, 1)
print Gdd
kq=(4*pi*Na*r)/((1/D)+(3/(kdd*r**2))*(np.exp((((Get/2)**2+(Gdd)**2)**(1/2)+Get/2)/(RT))+np.exp(Get/RT)))
PS! Plotten schaffe ich wahrscheinlich schon. Wäre da nur nicht der Error. Danke im Voraus!