0

Can someone help me with change of subject formula using python been stuck with it for two days now..

QT = R make T the subject of the formula

21st Apr 2021, 3:50 AM
Abdullah
5 Answers
0
How complex? Does it include factorisation? If not, you can just move the operators slowly one by one a bit like what I mentioned earlier, if it includes factorisation, then hopefully there's no power, if it does have power then it'll be quite complicated and I'm not really sure how to do it either, otherwise, similar to the approach I mentioned above, isolate the unknowns with subject to one side, take out the subject, and divide RHS with whatever remains (be careful if it involves division like A/B, if remove A, you need to replace it with 1)
21st Apr 2021, 7:33 AM
Hoh Shen Yien
Hoh Shen Yien - avatar
+ 1
A hint for you, you can first find the equal sign, and split the string to two, LHS and RHS. Then, identify the subject is on which side (LHS using your example). Then, first get all signs of the unknowns on the LHS (leftmost default to positive) , reverse and shift it to RHS if it doesn't contain subject. Then, if subject is paired with another unknown, bracket the entire RHS, put a / followed by that other unknown, and if the subject is divided by something, check for /, remove the unknown and send to RHS, beside the bracket mentioned earlier. If subject is at denominator, put 1/ over the RHS and swap subject to numerator on LHS. Note: this doesn't solve complex equation, but sufficient to solve yours
21st Apr 2021, 4:11 AM
Hoh Shen Yien
Hoh Shen Yien - avatar
0
Thanks.. what if I have a complex one
21st Apr 2021, 7:29 AM
Abdullah
0
Something like R = Q^2 - PR / Q + P
21st Apr 2021, 7:55 AM
Abdullah
0
P or R as subject? If Q then it is the complicated case I mentioned above, if P or R, the method I mentioned up there still works, isolating the unknowns with subject, then remove all R from the unknowns, divide by it to the other side. Finally you can check if / occurs twice on the other side and see if you want to bring it up
21st Apr 2021, 7:58 AM
Hoh Shen Yien
Hoh Shen Yien - avatar