Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python

Please can someone help me with an algorithm on how to do complex rearrange (change of subject formula) like when you have something like this b = sqrt(b^2 - 4ac) /2a make c the subject of the formula... I came up with this idea when I create a function called change(left, right, sub) Calling the function will be change(b, div(sqrt(sub(pow(b,2),mul(4,a,c))),mul(2,a)), "c") This how I planned on receiving my data when I have function that does the add, sqrt, sub, div.. but I don't know how to go about it..

2nd May 2021, 11:06 AM
Abdullah
2 Answers
0
Abdullah, You can use SymPy module of Python: https://www.sympy.org/en/index.html ...together with Numpy -module. Some help can be found also here: https://stackoverflow.com/questions/50284390/rearranging-and-solving-an-equation-in-python Edit: For me worked the power operator **, and the square root operator **(1/2)
2nd May 2021, 5:06 PM
ボリス
0
What if I don't want to use any libraries?
2nd May 2021, 6:15 PM
Abdullah