Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9787

Re: Question about DayOfWeek

From István Zachar <replicatorzed@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Question about DayOfWeek
Date 2012-04-25 04:37 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jn7v26$6en$1@smc.vnet.net> (permalink)
References <jn5s97$nvl$1@smc.vnet.net>

Show all headers | View raw


If I understand it correctly, the "Calendar`" package uses symbols for days instead of strings. Thus what is returned by

Needs["Calendar`"];
DayOfWeek[{1975,1,1}]==Thursday

is a symbol-to-symbol comparison (Wednesday==Thursday), just like a==b, and since none of the symbols have any value, Equal (==) is left unevaluated.

Use SameQ insted of Equal:

In[6]:= DayOfWeek[{1975, 1, 1}] === Wednesday
Out[6]= True

In[7]:= DayOfWeek[{1975, 1, 1}] === Thursday
Out[7]= False

Hope this helps,

Istvan




On Tuesday, April 24, 2012 10:37:43 AM UTC+1, Kent Holing wrote:
> DayOfWeek[{1975,1,1}]==Wednesday gives True (as it should), but DayOfWeek[{1975,1,1}]==Thursday gives
> Wednesday == Thursday and not False, as it should? Why is it so?

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Question about DayOfWeek Kent Holing <KHO@statoil.com> - 2012-04-24 09:37 +0000
  Re: Question about DayOfWeek István Zachar <replicatorzed@gmail.com> - 2012-04-25 04:37 +0000

csiph-web