# Weibull distribution parameterization

I have the following Weibull distribution:

$$f(x;\lambda,\beta) = (\lambda\beta)x^{(\beta-1)}e^{(-\lambda x^b)}$$ where $$\lambda$$ is scale parameter and $$\beta$$ is shape parameter.

I have an alternative parameterization for Weibull in r link:

$$f(x;a,b) = \frac{a}{b} (\frac{x}{b})^{(a-1)} e^{(- (x/b)^a)}$$ where $$a$$ is shape parameter and $$b$$ is scale parameter.

How do you equate the shape and scale parameters from above distributions. Below is my solution. Clearly, I'm wrong.

> l=0.5
> b=2.5
>
> dwei <- function(x,l,b){
+   l*b*x^(b-1)*exp(-l*(x^b))
+ }
>
> dwei(x=2,l,b)
 0.2089704
> dweibull(x=2, shape=b, scale = 1/l)
 0.4598493


I think your order of operations is wrong. As a simplified example, $$\left(\frac{x}{2}\right)^2 = \frac{x^2}{4},$$ so in your pdf, you need $$(\lambda x)^{\beta - 1}=\lambda ^{\beta -1}x^{\beta - 1}$$ in the first product, and likewise inside the exponential function.
Putting it all together: $$f(x;\lambda,\beta)= \lambda \beta (\lambda x)^{\beta - 1}\exp\left(-(\lambda x)^\beta\right)$$ and implemented in R to double-check:
dwei <- function(x,l,b){