Home>
-------------------------------------------------- -------------------------
AttributeError Traceback (most recent call last)
AttributeError:'Float' object has no attribute'exp'
The above exception was the direct cause of the following exception:
TypeError Traceback (most recent call last)
<ipython-input-19-6078c30c8f23>in<module>
     11 y=np.zeros(10000)
     12 for k in range(10000):
--->13 y[k]=P(v[k])
<ipython-input-19-6078c30c8f23>in P(v)
      8 v=np.logspace(6,23,10000)
      9 def P(v):
--->10 return (np.sqrt(3)*q**3*B*sin_pa/(m*c**2))*A(v/v_c)
     11 y=np.zeros(10000)
     12 for k in range(10000):
<ipython-input-8-a3e9f923667c>in A(x)
      5 return F(x)
      6 else:
---->7 return H(x)
<ipython-input-7-9ec1b5e6fe54>in H(x)
      2 return (4*np.pi/np.sqrt(3)/a)*(x/2)**(1/3)
      3 def H(x):
---->4 return ((np.pi/2)**(1/2))*(x**(1/2))*(np.exp(-x))
TypeError: loop of ufunc does not support argument 0 of type Float which has no callable exp method
Applicable source code

A(x), sin_pa,m,c,q, were defined as functions or numbers in the previous step.
The code below is the first to transition from A(x) to A(v/v_c).

from scipy.special import kv
import matplotlib.pyplot as plt
from scipy.integrate import quad
import numpy as np
import math
from math import gamma
from sympy import *
import os
for i in range(5):
    BmG=10**i
    B=BmG*10**(-6)
    for j in range (6):
        g=10**i
        v_c=3*a**2*q*B*sin_pa/(2*m*c*(2*np.pi))
        v=np.logspace(6,23,10000)
        def P(v):
            return (np.sqrt(3)*q**3*B*sin_pa/(m*c**2))*A(v/v_c)
        y=np.zeros(10000)
        for k in range(10000):
            y[k]=P(v[k])
What I tried
def P(v):
    v.float()
    return (np.sqrt(3)*q**3*B*sin_pa/(m*c**2))*A(v/v_c)


When set to

AttributeError Traceback (most recent call last)
<ipython-input-22-6eeb167a8524>in<module>
     12 y=np.zeros(10000)
     13 for k in range(10000):
--->14 y[k]=P(v[k])
<ipython-input-22-6eeb167a8524>in P(v)
      8 v=np.logspace(6,23,10000)
      9 def P(v):
--->10 v.float()
     11 return (np.sqrt(3)*q**3*B*sin_pa/(m*c**2))*A(v/v_c)
     12 y=np.zeros(10000)
AttributeError:'numpy.float64' object has no attribute'float'


Becomes
Also, if you use A(v) instead of A(v/V_c), you will not get an error.

def P(v):
            return (np.sqrt(3)*q**3*B*sin_pa/(m*c**2))*A(v)


I think the transition from A(x) to A(v/v_c) is not going well.