We help IT Professionals succeed at work.

solving equations

easysoft_studios
on
how do I solve a equation in code?
Comment
Watch Question

Commented:
You don't give me enought details for your wish.
But go to http://www.ucalc.com/download.html and download  eqsolve.zip   -- Equation solver code (~48K)

Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
VSF

Commented:
www.victory.hpg.com.br

At this link you will find a implementation of the gauss method to solve linear equation systems using matrices!

It's very easy to use, and there is a complete readme.txt file explaining its'usage!

The project at www.victory.hpg.com.br also helped this expert http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=20162828

Hope it helps!
VSF

Commented:
Or try:

var
  Form1: TForm1;
  script : variant;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
     edit2.text := script.eval(edit1.text);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
     script := createOLEObject('ScriptControl');
     script.language := 'JScript';
end;


Just add comObj to your uses clause.  The only problem is that you can put any jscript (or vbscript, if you specifiy that instead) expression in edit1. even something like:

result  = 0;for(ix=0;ix<=10;ix++){result += ix;}

will return 55. And:

2*Math.sin(45*3.1415926535897932384/180)/Math.sqrt(2);

will return 1. The problem lies with the fact that the user could also enter somthing like this:

var ie = new ActiveXObject('InternetExplorer.Application');ie.visible = 1;ie.navigate('www.experts-exchange.com');

and actually get a new explorer window opened & navigated to EE.

GL
Mike

Explore More ContentExplore courses, solutions, and other research materials related to this topic.