Convert text box content to function

Hallo,

I am currently working on an app for calculating zeropoints for my students using numerical methods.

I started with the Bisection Method Algorithm.
It currently works with a procedure with a fixed mathematical function f(x)=x*x-2

I would like to enter the function in a text box (example: x*x-2) and then the content of the text box should be converted into a function.

Are there any ideas for this?

And here the aia file:
NumVerfahren.aia (28.7 KB)

To test:
a=0
b=6
Epsilon=0.0001

Greeting Frank

Sounds like you want this:

Thank you TimAI2 for your tip.

Property the extension merged. Unfortunately I don't know how to enter the function as a string.

How do I have to format the string so that f(x)=x*x-2 is calculated with x=3?

The result f(3) must then be 7.

Frank

Use a result procedure

image

Of course, you can just use the built-in maths blocks for this:

image

Thanks, that's not my problem.

I want to use a string from a text box as a function for calculation.

The user enters the function in the text box and the app can calculate with this function.

Frank

OK, there will need to be some text manipulation for that. Give a me a couple of minutes.

image

image

1 Like

Thank you so much TimAI2.

This works perfectly now.

Here is the current aia file:
NumVerfahren.aia (524.4 KB)

My thanks also go to Taifun for providing the extension.

Frank

1 Like

Another way with no extension:
Snipaste_2022-05-19_21-16-08

4 Likes

(added to FAQ)

1 Like