5
$\begingroup$

This works fine;

((x - Sqrt[x])/(x + Sqrt[x]) - (x^2 - x)/36) /. x -> {1, 4, 8}

but this does not

((x - Sqrt[x])/(x + Sqrt[x]) == (x^2 - x)/36) /. x -> {1, 4, 8}

I expected it to return {True, True, False} but it returns a single False.

How do I get {True, True, False}? TIA.

$\endgroup$
1
  • $\begingroup$ for fun: MapThread[Equal, {(x - Sqrt[x])/(x + Sqrt[x]), (x^2 - x)/36} /. x -> {1, 4, 8}] or {(x - Sqrt[x])/(x + Sqrt[x]), (x^2 - x)/36} /. x -> {1, 4, 8} // MapThread[Equal]. $\endgroup$ Jul 7 at 10:50
7
$\begingroup$

Perhaps Map is what you are looking for

Map[(((x - Sqrt[x])/(x + Sqrt[x]) == (x^2 - x)/36)) /. x -> # &, {1,4, 8}]
(*{True, True, False}*)
$\endgroup$
9
$\begingroup$

Try

((# - Sqrt[#])/(# + Sqrt[#]) == (#^2 - #)/36) & /@ {1, 4, 8}
{True, True, False}

or

(x |-> ((x - Sqrt[x])/(x + Sqrt[x]) == (x^2 - x)/36)) /@ {1, 4, 8}
{True, True, False}

( |-> is Function, version 12.3!)

$\endgroup$
4
$\begingroup$

You can also use ReplaceAll, you just have to tell it to do multiple replacements for the different values of x:

((x - Sqrt[x])/(x + Sqrt[x]) == (x^2 - x)/36) /. 
  {{x -> 1}, {x -> 4}, {x -> 8}}
(* {True, False, True} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.