0
$\begingroup$

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?

$\endgroup$
7
  • 1
    $\begingroup$ 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... $\endgroup$
    – SOUser
    Jul 10, 2019 at 10:09
  • 2
    $\begingroup$ Use Dt instead of \[DifferentialD] (and declare c to be a constant, e.g., SetAttributes[c,Constant] or Dt[..., Constants->{c}]). $\endgroup$ Jul 10, 2019 at 12:08
  • $\begingroup$ @AccidentalFourierTransform Could you help to provide an input text that works ? $\endgroup$
    – SOUser
    Jul 10, 2019 at 12:19
  • $\begingroup$ Perhaps you should explain how you got your expected answer. It is not clear to me why it is correct. $\endgroup$
    – Somos
    Jul 11, 2019 at 12:24
  • 1
    $\begingroup$ @Somos cf. wikipedia, en.wikipedia.org/wiki/Planck%27s_law#The_law $\endgroup$ Jul 11, 2019 at 13:54

2 Answers 2

1
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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$. $\endgroup$
    – SOUser
    Jul 11, 2019 at 4:03
  • $\begingroup$ Many thanks for your efforts to help ! $\endgroup$
    – SOUser
    Jul 11, 2019 at 16:15
0
$\begingroup$

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]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.