Try to search your question here, if you can't find : Ask Any Question Now ?

Convert Advanced Mathematics 'including root 'String to code Execute by ScriptEngine library in Java

HomeCategory: stackoverflowConvert Advanced Mathematics 'including root 'String to code Execute by ScriptEngine library in Java
Avatarsourav asked 2 weeks ago

I have a series of advanced math I want to convert to string implemented by Java for example :

String mymath="45+√4+√5+sin(6)+6^3";

i used

 String res=  mymath.replace("√", 
 "Math.sqrt(").replace("sin","Math.sin").replace("^","pow(");

Get the result:

45+Math.sqrt(4+Math.sqrt(5+Math.sin(6)+6pow(3

Now I have a problem in closing parentheses when the conversion

1 Answers
Best Answer
AvatarFernando answered 2 weeks ago
Your Answer

5 + 20 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com