Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » PHPGoto page Previous  1, 2

evaluate an algebraic expression

 
Jump to:  
 
serave
PostPosted: Sun Aug 31, 2008 11:01 pm    Post subject: Re: evaluate an algebraic expression
       
On 31 ago, 17:44, cwdjrxyz <spamtr...@cwdjr.info> wrote:
Quote:
On Aug 31, 3:27 pm, serave <ramirez.sebast...@gmail.com> wrote:

My problem is not the equation, or simplifing it. i just need to
evaluate what evere equation is given by the user. How will no write
it as php or javsacsript will demant it. I need to transform the
equation to a language like php or javascript or whatevere i can use
web. I'm looking for some info like that. Maybe a predifine function
that does that job.

Thanks for the additional information. If I understand you correctly
now, you want a program into which you can type a mathematical
equation much as it would appear in a math text. Then you want the
program to take that input, convert it into some code to solve the
equation and perhaps tabulate the results in tables, plots etc.

If the above is so, there long have been programs designed to do this.
They are used by people in math, engineering, the sciences etc. Such
programs are extremely complex, and if this is what you have in mind I
would suggest that you not waste your time on such a project. I am not
sure that any one person, no matter how skilled, could come up with
such a program that would be anywhere close to the quality of what is
available. Some such programs can be put up on a server so that input
can be from the web. However such programs are very expensive, for
good reason. Even so, input has to follow strict rules for the program
to work properly. The program must have very complex error detection
features, for there is no telling what someone may type in. Such a
program would most likely be written mostly in C++ or something of
that sort.

tx a lot what you are saying is exactly what im looking for,but
hopefully free, or just a library to get the cuntion i just need it to
dosome additional work. i need to program some nnumerical methods, but
the entries must be given from and end user so i need the equation
parser
 

 
Jerry Stuckle
PostPosted: Sun Aug 31, 2008 11:15 pm    Post subject: Re: evaluate an algebraic expression
       
serave wrote:
Quote:
On 31 ago, 17:44, cwdjrxyz <spamtr...@cwdjr.info> wrote:
On Aug 31, 3:27 pm, serave <ramirez.sebast...@gmail.com> wrote:

My problem is not the equation, or simplifing it. i just need to
evaluate what evere equation is given by the user. How will no write
it as php or javsacsript will demant it. I need to transform the
equation to a language like php or javascript or whatevere i can use
web. I'm looking for some info like that. Maybe a predifine function
that does that job.
Thanks for the additional information. If I understand you correctly
now, you want a program into which you can type a mathematical
equation much as it would appear in a math text. Then you want the
program to take that input, convert it into some code to solve the
equation and perhaps tabulate the results in tables, plots etc.

If the above is so, there long have been programs designed to do this.
They are used by people in math, engineering, the sciences etc. Such
programs are extremely complex, and if this is what you have in mind I
would suggest that you not waste your time on such a project. I am not
sure that any one person, no matter how skilled, could come up with
such a program that would be anywhere close to the quality of what is
available. Some such programs can be put up on a server so that input
can be from the web. However such programs are very expensive, for
good reason. Even so, input has to follow strict rules for the program
to work properly. The program must have very complex error detection
features, for there is no telling what someone may type in. Such a
program would most likely be written mostly in C++ or something of
that sort.

tx a lot what you are saying is exactly what im looking for,but
hopefully free, or just a library to get the cuntion i just need it to
dosome additional work. i need to program some nnumerical methods, but
the entries must be given from and end user so i need the equation
parser


The point is - you are not going to find something like that for free.
They'll probably cost you tens of thousands of dollars.

As we've been trying to tell you. Such a script is not trivial. It
takes a lot of work to develop. And people don't give all of that work
away for free. They need to live, also.

It's also too specialized for the open source community. You'll find
very little interest there.

Probably the best free you'll find will be what Sjoerd recommended.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
 

 
Curtis
PostPosted: Mon Sep 01, 2008 4:46 am    Post subject: Re: evaluate an algebraic expression
       
serave wrote:
Quote:
On 31 ago, 15:32, Jerry Stuckle <jstuck...@attglobal.net> wrote:
serave wrote:
Do you know if there is something already wrote, maybe in javascript
or something caise i will take lots of lines to do it again. And there
might be somebody that has already wrote that?
It won't help much to have something already written in javascript -
unless you want to try to convert it to PHP yourself.

But even if you do, I don't know of anything which wouldn't be
proprietary. And as Sjoerd said, this is not trivial. It can be done,
but you have a lot of work ahead of you.

I did something like this many years ago in C. I used a structure with
three parameters - the two values and the operation to be performed.
The operation was simple - but if a value was computed, I pointed to the
structure whose results was the value (via a UNION in the structure) to
be used.

However, I was not dealing with variables, etc. All I need to do was
give the results for an expression. It was orders of magnitude simpler
than what you want to do. But it was still difficult to get everything
sorted out and computed properly.

tx for you information. But actually i'm going to work with php, but
if i can get something that evaluates(give the result) the function
writen by an end user, i can put it in variable and from then on i
will start my job in php

Just as a precautionary note, if you actually try to write some sort
of equation parser, you may be tempted to use eval(). *DON'T*. User
input mixed with eval() is perhaps the most dangerous exploit you can
expose.

If you do try to use Sjoerd's suggestion, do not forget to look up
PHP's command line sanitizing functions. For example, when passing
arguments, use escapeshellarg(). It's used for escaping *individual*
arguments.

Be extremely careful when exposing user input to the shell.

--
Curtis
 

 
Sjoerd
PostPosted: Mon Sep 01, 2008 7:50 am    Post subject: Re: evaluate an algebraic expression
       
On Aug 31, 5:29 pm, serave <ramirez.sebast...@gmail.com> wrote:
Quote:
How do i evaulate a mathematical expression that is entered in a text
field.

What exactly do you want? Why do you want to evaluate mathematical
expressions? Do you simply want the numerical value of y?
 

 
serave
PostPosted: Sun Sep 14, 2008 2:35 pm    Post subject: Re: evaluate an algebraic expression
       
On 1 sep, 02:50, Sjoerd <sjoer...@gmail.com> wrote:
Quote:
On Aug 31, 5:29 pm, serave <ramirez.sebast...@gmail.com> wrote:

How do i evaulate a mathematical expression that is entered in a text
field.

What exactly do you want? Why do you want to evaluate mathematical
expressions? Do you simply want the numerical value of y?

Exactly, thats what i need. The be explicit. the user enter the values
of the x`s and the program should return the y value, given teh math
equiation entered by the user.
 

Page 2 of 2 .:. Goto page Previous  1, 2

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

sztućce Angielski Zielona Góra Kwiaty Kredyty mieszkaniowe santander consumer bank