ploting planck's function

philippe rouxph.22 at gmail.com
Sun Nov 27 15:01:58 CET 2011


Hi,


Le 27/11/2011 14:37, Alexandre Abbes a écrit :
> 
> 
> I was trying to plot the planck's law function, but I do not have the
> expected curve, this might be due to precision problems.
> 
> We have f(l)=(2hc^2/l^5)* 1/(exp(hc/(ktl))-1)

I suppose you have to defined f in scilab like this :

function y=f(l)
   T=1000,c=3e8,k=1.3e-23,h=6.3e-34
y=(2*h*c^2/l^5)* 1/(exp(h*c/(k*t*l))-1)
endfunction

(do not forgot the products *  !) then you have to evaluate f on a set
of point


l=[1:0.01:10]// becareful to l=0 !!!
y=feval(l,f)

then you can plot the curve and had grids or ...

plot(l,y,'-r')
xgrid(3)



> 
> l is the wavelength.
> T=1000 (temperature).
> 
> and c=3e8, k=1.3e-23, h=6.3e-34.


remind that scilab use a floating point representation of reals numbers
with 1e-16 relative precision so that  : k=1.3e-23=h=6.3e-34=0 compared
to c=3e8 !!!

> 
> The curve I get is increasing, and looks like a parabola, wich is false,
> obviously. I get a better result with maxima, by the way.

since maxima use  symbolic calculus it can perform arbitrary precision
calculus.
> 
> Does anybody know how to increase the precision?

use a unit system where k=c=h=1 (and rescale results after calculations
....).

Philippe.




More information about the users mailing list