Evaluate an expression in terms other variables when lots of equations are involved

Unless I misunderstood something, this is different from a similarly worded question because I am not asking for the relationship between different variables here.

I want to convert an expression from one set of variables to another. For example, consider the following equations:

3*BP == 5*PC
9*AQ == 8*BQ
AC^2 == AB^2 + BC^2
PQ^2 == BP^2 + BQ^2
AP^2 == AB^2 + BP^2
BC == BP + PC
AB == AQ + BQ


This time, I want to get the value of 5*AC^4 + 4*AP^2 in terms of BQ and BP. Can this be done in Mathematica?

I will really appreciate any help on how to proceed. :)

This should get you there

Reduce[{3*BP == 5*PC, 9*AQ == 8*BQ, AC^2 == AB^2 + BC^2, PQ^2 == BP^2 + BQ^2,
AP^2 == AB^2 + BP^2, BC == BP + PC, AB == AQ + BQ}, {AC, AP, BQ, BP, PQ}]


From that you extract rules to evaluate your expression

5*AC^4 + 4*AP^2 //. {AC -> -(1/27) Sqrt[-2041 PC^2 + 2601 PQ^2],
AP -> -(1/27) Sqrt[-5200 PC^2 + 2601 PQ^2], PC -> BP*3/5,
PQ -> 1/24 Sqrt[729 AQ^2 + 1600 PC^2], AQ -> (8 AB)/17, AB -> (17 BQ)/9}


which will give you

(*4/729 (-1872 BP^2 + 289/64 (576 BP^2 + 576 BQ^2)) + (5 (-((18369 BP^2)/25) +
289/64 (576 BP^2 + 576 BQ^2))^2)/531441*)

Simplify[%]

(*(4096 BP^4)/125 + BP^2 (4 + (36992 BQ^2)/405) + (289 BQ^2 (324 + 1445 BQ^2))/6561 *)

• Thanks again Bill, you are awesome. :) So, the steps that I need to follow are: 1. Use reduce, pass all the equations and desired variables to it. 2. Use the //. expression to put the reduced values inside the expression that we want to evaluate. Commented Aug 3, 2018 at 22:06
• I have one question. :) Why is there an extra PQ inside Reduce when I want AC and AP to be expressed in terms of only BQ and BP? Thanks. Commented Aug 3, 2018 at 22:08
• If you look at the results from Reduce they use ==. If you look at the documentation for ReplaceRepeated or //. they use ->. Then there is the issue of minus signs. Since 5*AC^4 + 4*AP^2 was all even powers I cheated just a bit and just used the results without having to worry about powers of -1. Does that make sense?
– Bill
Commented Aug 3, 2018 at 22:09
• Try removing the PQ from Reduce and see what you get? I think you will get PQ in your results and that doesn't seem like what you wanted so I also solved for that and substituted that result into your expression to get rid of the PQ.
– Bill
Commented Aug 3, 2018 at 22:10
• Thanks again Bill, now I understand it. Reduce gives us the relation between different variables so that we can substitute their values in the expression that we want to evaluate using //.. Am I right? Commented Aug 3, 2018 at 22:20