Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4492 > unrolled thread
| Started by | Heike Gramberg <heike.gramberg@gmail.com> |
|---|---|
| First post | 2011-08-20 10:23 +0000 |
| Last post | 2011-08-20 10:23 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: SameQ to check for simplified radical expressions... doesn't work Heike Gramberg <heike.gramberg@gmail.com> - 2011-08-20 10:23 +0000
| From | Heike Gramberg <heike.gramberg@gmail.com> |
|---|---|
| Date | 2011-08-20 10:23 +0000 |
| Subject | Re: SameQ to check for simplified radical expressions... doesn't work |
| Message-ID | <j2o1um$4va$1@smc.vnet.net> |
Maybe you can convert your expressions to strings and use StringMatchQ. For example StringMatchQ[ToString[Sqrt[360]], ToString[HoldForm[6 Sqrt[10]]]] returns True, and StringMatchQ[ToString[Sqrt[360]], ToString[HoldForm[Sqrt[360]]]] returns False. Note that Simplify isn't needed since Mathematica automatically reduces square roots to their simplest radical form. Heike. On 19 Aug 2011, at 12:33, Roy Simpson 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. >
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web