Question: [Python] Why is the dFdt not giving me an array? I use the cross product. dBdt is printing out an array and v is initialized

[Python]

Why is the dFdt not giving me an array? I use the cross product. dBdt is printing out an array and v is initialized with s[0:2], shouldn't it print out an array?

[Python] Why is the dFdt not giving me an array? I use

In [79]: def func(s, t): VX, vy, x, y = 5 #initialize variables 9 = 1.602e-19 #C mue_const = le-7 I = 10 #Amps n = 100 #turns of wire in each coil R = .1 V = s[2:2] z = 5(2:4) dBdt = mue_const * (2*pi*R**2*I)/(2**2 + R**2) ** (3/2) dFdt = q* (np.cross(v, dBdt)) print (dBdt) print(dFdt) return concatenate ([dBdt,dFdt]) so = np.array ([1, 1, 0, .1]) ts = linspace(0,500,300) ans = odeint(func, so, ts, full_output = 1) [6.283185312-05 2.22144147e-85] -6.5069136286368435e-24 ValueError Traceback (most recent call last) in 19 se = np.array ([1, 1, 0, .1]) 20 ts = linspace(0,500,300) ---> 21 ans = odeint(func, se, ts, full_output = 1) - Anaconda3\lib\site-packages\scipy\integrate lodepack.py in odeint(func, yo, t, args, Dfun, col_deriv, full_output, ml, mu, rtol, atol, tcrit, ho, hmax, hmin, ixpr, mxstep, mxhnil, mxordn, mxords, printmessg, tfirst) 243 full_output, rtol, atol, tcrit, he, hmax, hmin, 244 ixpr, mxstep, mxhnil, mxordn, mxords, --> 245 int(bool(tfirst))) 246 if output[-1] in func(s, t) 15 print (dBdt) 16 print(dFdt) ---> 17 return concatenate([dBdt, dFdt]) 18 19 se = np.array ([1, 1, 0, .1]) <_array_function__ internals> in concatenate(*args, **kwargs) ValueError: all the input arrays must have same number of dimensions, but the array at index has 1 dimension(s) and the ar ray at index 1 has a dimension(s)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!