TransWikia.com

Hold parents of ArcTan

Mathematica Asked on May 11, 2021

If this question is beating a dead horse about Hold, Inactivate etc., a close vote is fair enough. That being said, I’m curious about ways to achieve this.

I have an expression, the result of an integral,

(-3 ArcTan[(1 - a)/Sqrt[1 - a^2]]^2 - ArcSin[a] (2 ArcTan[(1 - a)/Sqrt[1 - a^2]] + 
   ArcTan[a/Sqrt[1 - a^2]]) /. a -> 1/2) - (-3 ArcTan[(1 - a)/Sqrt[1 - a^2]]^2 - 
ArcSin[a] (2 ArcTan[(1 - a)/Sqrt[1 - a^2]] + ArcTan[a/Sqrt[1 - a^2]]) /. a -> 0)

I want to evaluate the two ReplaceAll‘s, and all ArcTan‘s and ArcSin‘s, but not any nodes higher than them in the expression tree. I obtained the full expression with

Inactive[(# /. a -> 1/2) - (# /. a -> 0)] &@
Integrate[(# /. b -> 1 - a) - (# /. b -> a) &@ Integrate[1/(1 + b^2 - a^2), b], a]

Bumbling around a bit, here’s what I got:

Activate[Inactivate[(# /. a -> 1/2) - (# /. a -> 0)], ReplaceAll] /. 
{
  Inactive[ArcTan][x_] :> Activate[ArcTan@x], 
  Inactive[ArcSin][x_] :> Activate[ArcSin@x]
}&@
Integrate[(# /. b -> 1 - a) - (# /. b -> a) &@ Integrate[1/(1 + b^2 - a^2), b], a]

I suppose this (activating ReplaceAll‘s, then replacing selected inactive expressions with their activated versions) is a pretty straightforward way of achieving this — is it a rightheaded approach? Are there more concise approaches, perhaps with Hold?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP