T tinmanjo Member Licensed User Apr 18, 2010 #1 Im trying to convert a sum say (1*6+3) as a string in vb you use :- sum="1*6+3" Eval(sum) which evalutes and calculates. =9 etc is there a way to do this in Basic4ppc?
Im trying to convert a sum say (1*6+3) as a string in vb you use :- sum="1*6+3" Eval(sum) which evalutes and calculates. =9 etc is there a way to do this in Basic4ppc?
Erel B4X founder Staff member Licensed User Longtime User Apr 18, 2010 #2 There is a module file that implements it. See the attached sample (download both files). Attachments Solver.sbp Solver.sbp 6.2 KB · Views: 363 EvalModule.bas EvalModule.bas 2.7 KB · Views: 371
T tinmanjo Member Licensed User Apr 18, 2010 #3 Thanks Erel, Ive tried running the example but im getting syntax errors, and the module has some, was this for an earlier version than 6.80?
Thanks Erel, Ive tried running the example but im getting syntax errors, and the module has some, was this for an earlier version than 6.80?
agraham Expert Licensed User Longtime User Apr 18, 2010 #4 Forget the demo (I don't understand it either ) and try just using the Eval Sub like result = EvalModule.Eval("1+3*12")
Forget the demo (I don't understand it either ) and try just using the Eval Sub like result = EvalModule.Eval("1+3*12")
Erel B4X founder Staff member Licensed User Longtime User Apr 18, 2010 #5 I think that the problem is that this code was adapted to v6.90 with the variables typing. You can find the same code that will work with your version under the samples folder. It is located under c:\program files\anywhere software\basic4ppc desktop\samples Forget the demo (I don't understand it either ) Click to expand... I don't understand as well it is an implementation of this: Cramer's rule - Wikipedia, the free encyclopedia which solves linear equations.
I think that the problem is that this code was adapted to v6.90 with the variables typing. You can find the same code that will work with your version under the samples folder. It is located under c:\program files\anywhere software\basic4ppc desktop\samples Forget the demo (I don't understand it either ) Click to expand... I don't understand as well it is an implementation of this: Cramer's rule - Wikipedia, the free encyclopedia which solves linear equations.
agraham Expert Licensed User Longtime User Apr 21, 2010 #6 I remembered that Rioven posted http://www.b4x.com/forum/code-samples-tips/1207-scientific-math-text-input-evaluator.html that is quite capable and supports functions. It could easily be made into a module.
I remembered that Rioven posted http://www.b4x.com/forum/code-samples-tips/1207-scientific-math-text-input-evaluator.html that is quite capable and supports functions. It could easily be made into a module.