constant model elasticity demand I need to be corrected if i have something wrong :
the elasticity of the demand is calculated : dq/dp    if q is the quantity and p the price
so to calculate it i take two prices p1 and p2, if i have an f function of the demand over the price i will have q1=f(p1) and q2=f(p2)
the elasticity will be
e=((p1 + p2) * (q2 - q1)) / ((q2 + q1) * (p2 - p1))
If i have a constant model:

to fit the curve i use log(Q) and log (P)
so i will have:
log(Q)=log(A)-B*log(P)
If i fit the curve with a linear model i will have a constant b=log(A) and a slope a=-B
log(Q)=b+a*log(P) and  -B is the elasticity .
but if I take and example from my data i found constant  b= 74.90 and a slope   a=-11.78
so the elasticity is supposed to be equal to -11.78.
but if I take two points and want to apply the first formula of the elasticity
e=((p1 + p2) * (q2 - q1)) / ((q2 + q1) * (p2 - p1))
let's say p1=1 and p2=2
if i want to calculate the demand
Q= exp(b+a*log(P))
Q= exp(b)* pow(p,a) 

( is it correct?)
so if i replace by p1 and p2:  q1=3.39 and q2=9.60
and e=-2.99 which is different from -11.78
and i dont get where am i wrong
 A: This is economics-speak, so some of the language may appear back-to-front or oversimplified (who else plots the independent variable on the $y$-axis and the dependent variable on the $x$ axis?).  In particular, writing

a constant $b=\log(A)$ and a slope $a=-B$

seems likely to be confusing.  Meanwhile the description of price elasticity as

$e=\dfrac{(p_1 + p_2)  (q_2 - q_1)}{(q_2 + q_1) (p_2 - p_1)}$

is only approximate, and only close to accurate when the changes are small.  Much better would be $e=\dfrac{\log(q_2/q_1)}{\log(p_2/p_1)}=\dfrac{\log(q_2) - \log(q_1)}{\log(p_2) - \log(p_1)}$, and this is supposed to the slope resulting from linear regression of $\log(Q)$ on $\log(P)$ under the assumption of constant elasticity.
So you seem to have the result $${\log(\hat q_i)}=74.90 -11.78 \log(p_i)$$ which, assuming you are using $\log_e$ rather than $\log_{10}$ or something else, would be equivalent to $$\hat q_i = 3.378\times 10^{32} \times p_i^{-11.78}$$ where $e^{74.90} \approx 3.378\times 10^{32}$ - which looks very big to me
So with your example of $p_1=1$ and $p_2=2$ you would get $q_1\approx 3.378\times 10^{32}$ and $q_2 \approx 9.606\times 10^{28}$ (you seem to have lost the powers of $10$).  Then $\frac{(p_1 + p_2)  (q_2 - q_1)}{(q_2 + q_1) (p_2 - p_1)}\approx -2.998$ as you have found, while $\frac{\log(q_2/q_1)}{\log(p_2/p_1)}=-11.78$
To show the quoted elasticity calculation almost works when changes are small, try an example of $p_1=1$ and $p_2=1.02$ giving $q_1\approx 3.378\times 10^{32}$ and $q_2 \approx 2.675\times 10^{32}$ and  $\frac{(p_1 + p_2)  (q_2 - q_1)}{(q_2 + q_1) (p_2 - p_1)}\approx -11.73$, which is not as bad.
