Help needed to make this code work for non algebraic expressions. Such as sin(x), ln(x) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help needed to make this code work for non algebraic expressions. Such as sin(x), ln(x)

This a code for finding real root of an expression using Newton-Rapson method. But this code works for pure algebraic expressions only. I want this code working for non algebraic expressions also. Thanks in advance https://code.sololearn.com/cSbepgoiJiRh/?ref=app

5th Jun 2019, 4:25 AM
Shankar Narayan K (all langs challenges accepted)
Shankar Narayan K (all langs challenges accepted) - avatar
3 Answers
+ 3
Oh ok ! You can "simply" do a string parse ! You can separate each members using the polish notation (you can find algorithm to translate normal to polish notation on Google) then you just have to add the parsing part for supported functions
3rd Aug 2019, 6:02 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
As I am not really good in maths (and am French, so understanding them in another language is hard one), can you details what you really expect ? (Examples of in/out) please ^^
24th Jul 2019, 9:21 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
Hey Baptiste E. Prunier , Here are a few examples: I/P: x^2 - ln(x) - 12 O/P: x = 3.6460 I/P: x * sin(x) + cos(x) O/P: x = 2.7984 I/P: log(x) - cos(x) O/P: x = 1.4184 I hope you can help. Thanks ☺☺
3rd Aug 2019, 11:14 AM
Shankar Narayan K (all langs challenges accepted)
Shankar Narayan K (all langs challenges accepted) - avatar