I'm trying to calculate the RMS current of a flyback converters primary switch node. The Waveform is shown below:
I'm okay with assuming it is a triangle wave with a duty cycle of 50%. The peak value is 1.25A and the Period time is 4u seconds.
I can calculate it using the following formula I found on the internet:

And I will find a RMS current of 0.51A what is right.
But my problem is when I try to calculate it with another method i believe is right I get a different answer. I hope someone can point out me where I'm wrong. See my calculation below:
$$ I_{RMS} = \sqrt{\frac{1}{T}\cdot\int_{0}^{T}I^2(t)dt} $$
I then simplify the integral to an easy area calculation
$$\int_{0}^{T}I^2(t)dt = (0.5 \cdot 0.5T \cdot I_{PK})^2$$
I work this all out to the following:
$$I_{RMS} = \sqrt{\frac{1}{T}(0.5 \cdot 0.5T \cdot I_{PK})^2}$$
When i fill everything in:
$$I_{RMS} = \sqrt{\frac{1}{4\mu}(0.5 \cdot 0.5 \cdot 2\mu \cdot 1.25)^2} $$ $$I_{RMS} = 3.125\cdot10^{-4} A $$
I end up wrong. I think my problem is with the simplification. But it doesn't make sense to me why it should be wrong.
