Re: SameQ to check for simplified radical expressions... doesn't work
- To: mathgroup at smc.vnet.net
- Subject: [mg120976] Re: SameQ to check for simplified radical expressions... doesn't work
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sat, 20 Aug 2011 06:15:57 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Here are your three expressions:
{Simplify[Sqrt[360]], Sqrt[360], Hold[6*Sqrt[10]]}
{6 Sqrt[10], 6 Sqrt[10], Hold[6 Sqrt[10]]}
As you can see, the first two are identical, and the third is not.
So the "problem" is that Simplify isn't doing anything.
Now consider:
FullForm@Sqrt[360]
Times[6,Power[10,Rational[1,2]]]
Now imagine this one with 360 in place of 10:
FullForm@Sqrt[10]
Power[10,Rational[1,2]]
LeafCount /@ {Sqrt[360], Sqrt[10]}
{7, 5}
ByteCount /@ {Sqrt[360], Sqrt[10]}
{264, 184}
The second is obviously simpler, hence Sqrt[360] is simpler than 6
Sqrt[10].
But Mathematica doesn't see it that way, and apparently, neither do you.
Bobby
On Fri, 19 Aug 2011 05:33:06 -0500, Roy Simpson <roy at mathemaddicts.com>
wrote:
> Hello,
>
> I have what appears to be a simple issue, but I cannot for the life of
> me figure it out. I will have a randomized number, a, and I am going to
> simplify the square root of this. Then I want to compare this to a
> radical expression that a student enters, say b. Thus, the idea should
> be something like
>
> Simplify[Sqrt[a]] === Sqrt[b]
>
> For sake of this example, let's suppose the number I want to consider is
> the square root of 360. I only want the statement to return TRUE if the
> rhs of this SameQ is exactly 6*Sqrt[10].
>
> Unfortunately,
>
> Simplify[Sqrt[360]] === Sqrt[360]
> returns TRUE.
>
> I tried a few variations with Hold, but they always return false if the
> student enters the correct answer. For example, if the student entered
> 6*Sqrt[10], then
>
> Simplify[Sqrt[360]] === Hold[6*Sqrt[10]]
> returns FALSE
>
> What am I doing wrong? Any help would be appreciated.
>
--
DrMajorBob at yahoo.com
- Follow-Ups:
- Re: Re: SameQ to check for simplified radical
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: SameQ to check for simplified radical expressions... doesn't work
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: SameQ to check for simplified radical