Good afternoon
I make a calculator witch want to find integration value by use Rihman sum and find area
I make f(x) and want to find value of f(x) in each X=xi
so i need to replace X with value (xi) and find the result
I use
dim T as string
t = textbox1.text
t.replace("X",1)
but I have error
for example
F(x)= 5*Sin(X)
and want to find area between 1-2
we divided filed [1-2] to 10
make a loop
while i<=2 then
Area = Area + F(i)
I have problem in replace
what I can do ?
[EDIT - OP Code from "Solution"]
I use VBProvider to compile the equation (as string) to find result
I use :CodeDom.Compiler.CompilerParameters
this find a value of any string like
Sin(1)*3-4
but to find a result of integration between
[a,b]
, I devided filed into 1000000 filed (dx)
while dx = [a-b]/n<br />
find value of integration we find value of f(x) in Xi then find dA=F(Xi)*dx
then find A = Sum(dA)
this method called Rihman sum
Now I make a loop find a value of F(Xi) where Xi between [a,b]
I have an equation as string (for example : F(x) = 3*Sin(x) )
I want to calculate integration between [1,2] so I must find F(x) value when
X=1
X=1.1
X=..
X=1.9
X=2
and find A=Sum(dA) = Sum (F(Xi))*dX
so I need a loop replace X with its value (1,1.1,1,2,....,1.9,2)
I wish you understand me Smile | :)