Mathematica Asked on October 3, 2021
I want to plot a density curve but when I draw the y-axis not getting to 1 (as normalized)
Subscript[a, p]=0.428;Subscript[[Alpha], p] =1.04;R = 2.45;
Subscript[[Rho], p1][r_] = Subscript[[Rho], 0]/((E^((r - R)/Subscript[a, p]) + E^(-((r + R)/Subscript[a, p])))*(0.5*(r/R)^2 + 0.5)^Subscript[[Alpha], p] + 1)
(I used this code to find Subscript[[Rho], 0] and make the density normalized)
4*Pi*NIntegrate[Subscript[[Rho], p1][r]*r^2, {r, 0, Infinity}]
Plot[Subscript[[Rho], p1][r], {r, 0, 8}]
You need to estimate the value of $rho_0$ using NIntegrate
:
Subscript[a, p] = 0.428; Subscript[α, p] = 1.04; R = 2.45;
Subscript[ρ, 0] = 1/NIntegrate[1/(
1 + (E^(2.336448598130841` (-2.45` + r)) +
E^(-2.336448598130841` (2.45` + r))) (0.5` +
0.08329862557267803` r^2)^1.04`), {r, 0, ∞}]
Subscript[ρ, p1][r_] = Subscript[ρ, 0]/((E^((r - R)/Subscript[a, p]) +
E^(-((r + R)/Subscript[a, p])))*(0.5*(r/R)^2 + 0.5)^Subscript[α, p] + 1)
Plot[Subscript[ρ, p1][r], {r, 0, 8}]
And in Mathematica you should avoid superscripts and subscripts. Using ap
and αp
would be less prone to unexpected consequences.
Correct answer by JimB on October 3, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP