comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: about the blackbody radiation curve
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: about the blackbody radiation curve [message #72373] Fri, 03 September 2010 06:52
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Wox wrote:
>
> Do something like
>
> y=a/(exp((h*c)/(k*x*t))-1)
> ind=where(x eq 0,ct)
> if ct ne 0 then y[ind]=0

I would recommend checking stuff before the calculation is done:

; Check values
loc = WHERE(x LT Tolerance OR FINITE(x) EQ 0, count)
IF ( count GT 0 ) THEN $
MESSAGE, 'Input X-values < or = 0.0, NaN, or Inf found.'

where "Tolerance" is the eps output from MACHAR. One should avoid floating point equality tests.

cheers,

paulv
Re: about the blackbody radiation curve [message #72375 is a reply to message #72373] Fri, 03 September 2010 05:36 Go to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Thu, 2 Sep 2010 20:37:29 -0700 (PDT), panshu Zhao
<rochesterzhao@gmail.com> wrote:

> PRO radiation
>
>
> h=6.626068e-27;
> k=1.38066e-16;
> c=2.997925e+10;
> t=6000;
> x=findgen(100)*0.0000001;
> a=2*h*(c^2)*(x^(-5));
>
> if x=0 then begin
> y=0
> endif else begin
> y=(a)/ (exp((h*c)/(k*x*t))-1)
> endelse
> plot,x,y
>
> END

Do something like

y=a/(exp((h*c)/(k*x*t))-1)
ind=where(x eq 0,ct)
if ct ne 0 then y[ind]=0
Re: about the blackbody radiation curve [message #72378 is a reply to message #72375] Thu, 02 September 2010 22:40 Go to previous message
mankoff is currently offline  mankoff
Messages: 131
Registered: March 2004
Senior Member
On Sep 2, 8:37 pm, panshu Zhao <rochesterz...@gmail.com> wrote:
>  if x=0 then begin
no.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: how to change button names on the dialog_message
Next Topic: Re: split array

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:30:21 PDT 2025

Total time taken to generate the page: 0.00654 seconds