# Recreate specific plot in Mathematica

Can anyone help on this ?

I did this

c = 2.998 10^8;
h = 6.62607015 10^-34;
Kb = 1.380649 10^-23;

i[\[Lambda]_,
T_] := ((2 Pi h c^2)/(\[Lambda]^5 (Exp[(h c)/(\[Lambda] Kb T)] -
1)));

M = Plot[i[\[Lambda], 3000], {\[Lambda], 0, 2.5 10^-6},
PlotRange -> Automatic,
PlotStyle -> {Thickness [0.005], Green},
Filling -> Axis, FillingStyle -> Green ];

N = [i[\[Lambda], 4000], {\[Lambda], 0, 2.5 10^-6},
PlotRange -> Automatic ,
PlotStyle -> {Thickness [0.005], Blue, Dashed},
Filling -> Axis];

O =  [i[\[Lambda], 5000], {\[Lambda], 0, 2.5 10^-6},
PlotRange -> Automatic ,
PlotStyle -> {Thickness [0.005], Orange}];

Show[M , N , O, GridLines -> Automatic , PlotRange -> Automatic ,
Frame -> True , AxesLabel -> {\[Lambda][m], (watts/m^3)},
Epilog -> {Insert [
Framed[Style["T=3000K", 10], Background -> White], {8.23 10^-7,
5.42 10^13}],
Insert [
Framed[Style["T=4000K", 10], Background -> White], {8.23 10^-7,
1.64 10^13}],
Insert [
Framed[Style["T=5000K", 10], Background -> White], {8.75 10^-7,
3.90 10^13}]}] // Quiet


and I get this "is too small to represent as a normalized machine number; precision
may be lost". Can anyone help please

• Looks like a homework question. Post the code you have tried. Feb 27 at 21:02
• Have you already seen PlanckRadiationLaw[]? Feb 27 at 21:03
• I would recommend not using capital letters to start your symbol names. N, for example, is a built-in which I would definitely not want to overwrite. Feb 28 at 15:28
• Still not working :( Feb 28 at 15:34
• I guess I meant it should have been an edit. Feb 28 at 23:45

This is a possibility for what you want:

c = 2.998  10^8 ;
h = 6.62607015 10^-34 ;
Kb = 1.380649 10^-23 ;

i[l_, T_] := (2 Pi h c^2)/(l^5 (Exp[(h c)/(l Kb T)] - 1));

Plot[{i[l, 3000], i[l, 4000],i[l, 5000]}, {l, 0, 2.5 10^-6}, PlotRange -> All]// Quiet



I added //Quiet in the end because it complained about having to deal with such small numbers.

For styling the plot (color, filling, labeling...) you should take a look at the options of the Plot function in the documentation. Ask if you need any help with that.

• yes please, I did it first and kept getting failed and now I'm getting an empty graph, I'm sorry if it's to much but I'm new to this :( Feb 27 at 22:34
• @user77551 To get the exact graph you want, simply copy the code I wrote and add more options, like Filling-> Axis, Frame-> True and so on. You can find all the options of the Plot function very easily in the documentation. If your code isn't working, I think it's better if you post it here so people can point out what you're doing wrong. Feb 28 at 0:38
• Also, pay attention to the fact that you defined your constants wrong, you can't use "x" as "times" because it will be interpreted as a variable. Same thing goes for the units. Notice how the constants are defined in the code I posted. Feb 28 at 2:10
• I keep getting this massage " is too small to represent as a normalized machine number; precision" , Can I show my work and you tell me where is the mistake ? Feb 28 at 8:24

You have a number of problems in your code.

Mathematica reserves uppercase N and O, you can't reassign them (well, at least not easily). You don't really need them.

Your code doesn't define 3 plots, so the Show can't show 3 curves. That said you can avoid the Show completely.

Also, you've used Insert instead of Inset in the Epilog assignments.

c = 2.998 10^8;
h = 6.62607015 10^-34;
Kb = 1.380649 10^-23;

i[\[Lambda]_,
T_] := ((2 Pi h c^2)/(\[Lambda]^5 (Exp[(h c)/(\[Lambda] Kb T)] -
1)));

Plot[{i[\[Lambda], 3000], i[\[Lambda], 4000],
i[\[Lambda], 5000]}, {\[Lambda], 0, 2.5*10^-6},
PlotRange -> All,
PlotStyle -> {
{Thickness[0.005], Green},
{Thickness[0.005], Blue, Dashed},
{Thickness[0.005], Orange}},
Frame -> True,
FrameLabel -> {"\[Lambda][m]", "(watts/m^3)"},
Filling -> {2 -> Axis, 3 -> 2},
FillingStyle -> {1 -> None, 2 -> Automatic, 3 -> Orange},
GridLines -> Automatic,

Epilog -> {
Inset[
Framed[Style["T=3000K", 10], Background -> White], {8.23*10^-7,
0.75*10^13}],
Inset[Framed[Style["T=4000K", 10],
Background -> White], {8.23*10^-7, 1.64*10^13}],
Inset[Framed[Style["T=5000K", 10],
Background -> White], {8.75*10^-7, 3.90*10^13}]}
] // Quiet


You need to do some additional formatting of the Epilog style and the placement, but I'll leave that to you.