+ 3
Challenge 5 :- Differential count
Write a program to count , in how many tries the differentiation of a given expression becomes equal to the right hand side . For example :- If a user enters :- x^3 + 12x^2 + 5x = 2x^2 + 7x + 10 I suggest you to use differentiation of a simple expression like the above , but if you wish you can even make it more complex* . So if we differentiate the above expression on both sides till L.H.S = R.H.S then :- 1) 3x^2 + 24x + 5 = 4x + 7 + 0 2) 6x + 24 + 0 = 4 3) 6 + 0 = 0 4) 0 = 0 Output should be 4.
3 Respuestas
+ 10
Good Challenge! My try:
https://code.sololearn.com/WNDQ0TS4QIMA/?ref=app
+ 2
My attempt in Ruby below. I like the methods of Krishna and Sayan. However, I wanted to output the equation at each step of the differentiation to demonstrate the process.
https://code.sololearn.com/c6nBo5Xbij10/?ref=app
This program takes equations input by the user, or will default to the example from the original challenge if no input is given. It does need more error catching in case of improper input formatting, and only takes "simple" equations, but seems to work well.
+ 1