I run this code:
Simplify[ArcTanh[x] + ArcTanh[y]]
and it keeps returning:
ArcTanh[x] + ArcTanh[y]
How do I direct it to simplify it that way ?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI run this code:
Simplify[ArcTanh[x] + ArcTanh[y]]
and it keeps returning:
ArcTanh[x] + ArcTanh[y]
How do I direct it to simplify it that way ?
A little bit of trickery:
ArcTanh[x] + ArcTanh[y] // Tanh // TrigExpand // FullSimplify // ArcTanh
(* ArcTanh[(x + y)/(1 + x y)] *)
Note the parentheses.
TrigToExp
in place of TrigExpand
works as well. The order of the last two commands also seems not to matter.
$\endgroup$
– Semiclassical
Aug 18 '16 at 19:02
TrigToExp[]
is that the underlying algebraic function is not returned at once, which makes FullSimplify[]
do more work.
$\endgroup$
– J. M.'s ennui♦
Aug 19 '16 at 8:50
Probably, MathematicalFunctionData["ArcTanh"]
knows about this.
First let's see what categories of things are known:
MathematicalFunctionData["ArcTanh", "Properties"]
ah well, let's just list them all (this will take a while to download the first time around)
all = DeleteDuplicates@Flatten[MathematicalFunctionData["ArcTanh", #] & /@
MathematicalFunctionData["ArcTanh", "Properties"]];
now let's look whether that fact about ArcTanh[_] + ArcTanh[_]
is in there
facts = Cases[all,
Function[{_, _},
e_ /; Not@FreeQ[e, Inactivate[ArcTanh[_] + ArcTanh[_]]]]
];
maybe some of these help. Let's Activate them.
activefacts = Through[facts[x, y]] // Activate
drop some conditions
activefacts = Assuming[x \[Element] Reals && y \[Element] Reals, FullSimplify@activefacts];
Now
activefacts /. {x -> ..., y -> ...}
should be a list of True
, Undefined
or Indeterminate == ...
for any real x
and y
.
(However, it seems to break here for exactly one of them being 1, the other not, activefacts /. {x -> 1, y -> 0.9}
is {False, Undefined, False}
)
I think this is a method worth knowing in general.
For example, use
all = MathematicalFunctionData["Sinh", #] & /@
MathematicalFunctionData["Sinh", "Properties"];
all = Flatten@all;
Cases[all,
Function[{_, _}, e_ /; Not@FreeQ[e, Inactivate@Sinh[_ + _]]]
]
to learn everything MathematicalFunctionData
knows about $\sinh(x + y)$.
This is just not true for all (x,y)
:
(ArcTanh[x] + ArcTanh[y] - ArcTanh[x + y/(1 - x y)]) /. x -> 0.23 /.y -> .323
-0.0916564
or
(ArcTanh[x] + ArcTanh[y] - ArcTanh[(x + y)/(1 - x y)]) /.x -> 0.23 /. y -> .323
-0.11988
Solve[ArcTanh[x] + ArcTanh[y] == ArcTanh[x + y/(1 - x)], {x, y}]
{{x -> 0}, {y -> 0}, {y -> -1 - x + x^2}}
You should define a replacement rule somehow. You can store that rule in a variable and apply it locally.
rule = ArcTanh[x_] + ArcTanh[y_] :> ArcTanh[x + y/(1 - x)];
(* only first two terms are merged *)
ArcTanh[x] + ArcTanh[y] + ArcTanh[z] /. rule
ArcTanh[x + y/(1 - x)] + ArcTanh[z]
(* merging until rule no longer applies *)
ArcTanh[x] + ArcTanh[y] + ArcTanh[z] //. rule
ArcTanh[x + y/(1 - x) + z/(1 - x - y/(1 - x))]
Or you can associate the rule with ArcTanh
directly. However, that is a System
symbol and System
symbols are (without exception I think) Protected
, so do Unprotect
first.
Unprotect[ArcTanh];
ArcTanh /: ArcTanh[x_] + ArcTanh[y_] := ArcTanh[x + y/(1 - x y)]
Protect[ArcTanh];
If you do this, ArcTanh
behaves as desired and defined on its own, every time.
You can visit the documentation center of Mathematica for trigonometric expressions at this address tutorial/TrigonometricExpressions
for more info.
In case you need its algebraic simplification you can use this code:
TrigToExp[ArcTanh[x] + ArcTanh[y]]
Which returns this as a result:
-(1/2) Log[1 - x] + 1/2 Log[1 + x] - 1/2 Log[1 - y] + 1/2 Log[1 + y]
ArcTanh[x] + ArcTanh[y] - ArcTanh[x + y/(1 - x y)] //. {x -> 0.2, y -> 0.2}
returns a nonzero value. $\endgroup$ – bill s Aug 18 '16 at 12:22ArcTanh[x] + ArcTanh[y] = ArcTanh[(x + y)/(1 + x y)]
. Note the parentheses, plus the change of sign in the denominator. (It's a minus sign for the inverse tangent function, but a plus sign for the inverse hyperbolic tangent function.) $\endgroup$ – Michael Seifert Aug 18 '16 at 16:20