# How to correctly inter-convert between two related infinitesimals?

The following input text

Clear[ρ, ν, λ, T, h, c, kB]
λ[ν_] := c/ν
ρ[ν_, T_] := (8 πh/c^3) (ν^3/(Exp[h ν/(kB T)] - 1)) $DifferentialD]ν ρ[ν, T] ρ[λ, T]  is employed to get the expression for $$\rho [\lambda ,T]$$, which is expected to be (equivalent to) $$\frac{8 \pi hc}{\lambda^5}\;\frac{d\lambda }{ \exp \left(\frac{h c}{\lambda k_\text{B} T}\right)-1}$$ but turns out to be (8 λ^3 πh \[DifferentialD]λ)/(c^3 (-1 + E^((λ)/(kB T))))  which visually appears \[ \frac{8 \lambda^3 \pi h\; d\lambda}{c^3 [\exp \left(\frac{h \lambda} {k_\text{B} T}\right)-1]}$

As can be told by comparison, $$\lambda$$ is literally substituted for $$\nu$$. Could you help to suggest how to correctly inter-convert between two related infinitesimals?

• It seems that I cannot use  or \[] to display the equations: Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon... – SOUser Jul 10 '19 at 10:09
• Use Dt instead of \[DifferentialD] (and declare c to be a constant, e.g., SetAttributes[c,Constant] or Dt[..., Constants->{c}]). – AccidentalFourierTransform Jul 10 '19 at 12:08
• @AccidentalFourierTransform Could you help to provide an input text that works ? – SOUser Jul 10 '19 at 12:19
• Perhaps you should explain how you got your expected answer. It is not clear to me why it is correct. – Somos Jul 11 '19 at 12:24
• @Somos cf. wikipedia, en.wikipedia.org/wiki/Planck%27s_law#The_law – AccidentalFourierTransform Jul 11 '19 at 13:54

I think that the following (revised) code comes close to what you want:

SetAttributes[c, Constant];
Clear[\[Rho], \[Nu], \[Lambda], T, h, c, kB];
\[Lambda][\[Nu]_] := c/\[Nu];
\[Nu] /: Dt[\[Nu]] = DifferentialD[\[Nu]];
\[Lambda] /: Dt[\[Lambda]] = 1/ Dt[\[Lambda][\[Nu]], \[Nu]] DifferentialD[\[Lambda]];
\[Rho][x_, T_: T] := (8 \[Pi] h/c^3) (x^3/(Exp[h x/(kB T)] - 1)) Dt[x];

\[Rho][\[Nu]]
-\[Rho][\[Lambda][\[Nu]]]/. \[Nu]->\[Lambda]


using the Wikipedia Planck's law article as a guide.

I am not sure why the code does the right thing.

• Thanks for your efforts. But the result is not correct. For example, the $\lambda$ should be on the denominator and there should be no $c$. – SOUser Jul 11 '19 at 4:03
• Many thanks for your efforts to help ! – SOUser Jul 11 '19 at 16:15

With the help of @AccidentalFourierTransform and @Somos, the following input text meets my need

Clear[\[Rho], \[Nu], \[Lambda], T, h, c, kB]
SetAttributes[{h, c, kB}, Constant]

\[Rho][argWhichShouldRepresentFreq_,
T_] := (8 \[Pi]h/
c^3) (argWhichShouldRepresentFreq^3/(Exp[
h argWhichShouldRepresentFreq/(kB T)] - 1)) Dt[
argWhichShouldRepresentFreq]

\[Rho][\[Nu], T]
\[Rho][c/# &[\[Lambda]], T]


and the following input text uses /: to display better

Clear[\[Rho], \[Nu], \[Lambda], T, h, c, kB]
SetAttributes[{h, c, kB}, Constant]

\[Rho][argWhichShouldRepresentFreq_,
T_] := (8 \[Pi]h/
c^3) (argWhichShouldRepresentFreq^3/(Exp[
h argWhichShouldRepresentFreq/(kB T)] - 1)) Dt[
argWhichShouldRepresentFreq]

\[Nu] /: Dt[\[Nu]] = DifferentialD[\[Nu]]
\[Lambda] /: Dt[\[Lambda]] = DifferentialD[\[Lambda]]

\[Rho][\[Nu], T]
\[Rho][c/# &[\[Lambda]], T]