Group Abstract Group Abstract

Message Boards Message Boards

0
|
9.9K Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

How do you find type of variable and get an == on the type to evaluate?

Posted 11 years ago

Sorry for such a basic question but after several hours of search I am still flummoxed by this.

How do you detect variable types in Mathematica? (a pointer to an answer works as well)

I want to be able to have a statement evaluate to true if an arguement is real and false if it not. The true part works, but Mathematica just chooses (I am a rookie and don't quite understand why) not to evaluate the statement if it is false.

Thank you,

Brent

Attachments:
POSTED BY: Brent Halonen
4 Replies
POSTED BY: David Reiss

That makes more sense, I've used it myself in Solve, just never thought of that reason.

TrueQ seems like a useful function. Lots of different understandings of "equals" is possible, so there must be a equally large set of equality operators.

POSTED BY: Brent Halonen

Thanks for the quick and simple answer, I am still confused on what that means for how the language is written.

As I understand it:

SameQ is a strict equality test that returns false unless it returns true. Equal is a looser equality test (allows for type differences) but doesn't automatically return false.

Do you know why Mathematica does not return a false in this when == is used? What advantages does this give?

Is this because Equals will sometimes try to return true when they are slightly different, and want to avoid returning false negatives?

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