0
$\begingroup$

I have an equation of the type

Exp[a[r]] + Exp[a[r]/2] + Exp[-a[r]] 

And I want to rule

Exp[a[r]] -> 1-2*m[r]/r 

so that it fits the other terms as well. How can I do this directly?

$\endgroup$
4
  • $\begingroup$ Thanks. I made some changes. a[r] is any function of r $\endgroup$ Commented Feb 2, 2023 at 2:17
  • $\begingroup$ You haven't resolved the issue. Exp has a predefined meaning. If it is intended to be a user-defined symbol then use some other symbol. Otherwise, you presumably mean either Exp[a[r]] or E^(a[r]) (they are equivalent). $\endgroup$ Commented Feb 2, 2023 at 2:23
  • $\begingroup$ And on the RHS of the rule, do you mean 1 - 2*m[r]/2 as shown (which is just 1 - m[r]) or did you intend (1 - 2*m[r])/2 $\endgroup$ Commented Feb 2, 2023 at 2:36
  • $\begingroup$ Sorry, I was using the python language. I made the changes you mentioned $\endgroup$ Commented Feb 2, 2023 at 2:38

1 Answer 1

1
$\begingroup$

Keep the LHS of rules as simple as possible

expr = Exp[a[r]] + Exp[a[r]/2] + Exp[-a[r]]; expr /. a[r] -> Log[1 - 2*m[r]/r] // Simplify (* 1 + r/(r - 2 m[r]) - (2 m[r])/r + Sqrt[1 - (2 m[r])/r] *) 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.