Message Boards Message Boards

0
|
8932 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

PlanckRadiationLaw not working?

Hi all,

Mathematica 10.4 seems to be not working for me here. I tried the PlanckRadiationLaw function. However, already the examples here (https://reference.wolfram.com/language/ref/PlanckRadiationLaw.html) do not work for me. See attached image for output. I was also trying to setup Planck's law myself (well known function, see Wiki), including units, but it did not work. After an hour searching for errors I found that Mathematica has problems with Quantities in the Exp[expr] function, even though UnitSimplify tells me that expr is dimensionless.

I really don't know what is going on. Someone having similar experiences?

Cheers Sascha

enter image description here

POSTED BY: Sascha Agne
3 Replies

Whenever the WRI approach gets too convoluted and you get lost in the thickets it can help to retreat to basics.

Here is a definition for Planck's radiation law.

PlanckLaw[\[Nu]_, T_] := (2 h \[Nu]^3)/c^2 1/(E^((h \[Nu])/(k T)) - 1) 

Here is data for the input units:

data = {h -> Quantity[1, "PlanckConstant"], 
  c -> Quantity[1, "SpeedOfLight"], 
  k -> Quantity[1, 
    "BoltzmannConstant"], \[Nu] -> \[Nu] Quantity[None, "Hertz"], 
  T -> T Quantity[None, "Kelvins"]}

and the output units

outputUnits = 
 Quantity[None, 
   "Watts"]/(Quantity[None, "Steradians"] Quantity[None, 
     "Meters"]^2 Quantity[None, "Hertz"])

Then we substitute the input constants and variables into the PlanckLaw and divide out the output units to obtain a pure numeric expression. But there is one catch. Steradians are dimensionless but they are not removed from the expression. This may be the reason the plot was not made. The solution is to remove it by a rule.

step1 = PlanckLaw[\[Nu], T] /outputUnits
step2 = step1 /. data
step3 = step2 // UnitConvert[#, "SIBase"] &
NPlanckLaw[\[Nu]_, T_] = step3 /. Quantity[sr_, "Steradians"] :> sr

The plot can then be made:

Plot[NPlanckLaw[\[Nu], 300], {\[Nu], 0, 10^14},
 PlotRange -> All]

enter image description here

Dear Sascha,

I can reproduce your problem on OSX and Mathematica Versions 10.4 and 10.4.1. It does work fine on MMA 10.3.1.

I have reported that now.

Cheers,

Marco

POSTED BY: Marco Thiel

Not working under Windows 10 Professional with Mathematica 10.4.1 too,

PlanckRadiationLaw[Quantity[10000, "Kelvins"], "SpectralPlot"]
PlanckRadiationLaw[Quantity[300, "DegreesCelsius"], "SpectralPlot"]

return empty plots.

POSTED BY: Udo Krause
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract