473,624 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Equation parser - where did I see it?

Hi,
A few months ago, I saw an equation parser, written in c#, and using
regular expressions (I think!), but now I cannot recall where I saw
it- if anyone saw anything like this, could they please post the url?
>From memory,
the parser not only dealt with operator precedence, but also the use
of brackets, so that any complicated expession could be re-written as
an equation that could be read from left-to-right, as a simple
sequence of sub-equations using basic operators, +,-,/,*

The reason why I ask is that I am anticipating user input into a form
as a string, and I need to convert it into
an equation. The user inputted expression could be something like (a+
(b-d)*(e-c))/f so I need to find a way to parse it.

TIA

Paul

Feb 15 '07 #1
6 7986
I doubt if this is what you saw earlier, but here is a link to a
TRINUG usergroup meeting presentation that describes making a
WindowsForm DataGridView into Excel. It has a very simple/minimal C#
calculation engine defined that handles precedence and parentheses.
Maybe it will be of help in your task.

http://www.trinug.org/Portals/0/DataGridViewCus tomization%20-%20Oct%20'06.zi p

=============== ========
Clay Burch
Syncfusion, Inc.

Feb 15 '07 #2
Maybe this: http://www.osix.net/modules/article/?id=761
Or this: http://www.osix.net/modules/article/?id=776

HTH
Fabrizio

<tr************ ***@btinternet. comwrote in message
news:11******** **************@ k78g2000cwa.goo glegroups.com.. .
Hi,
A few months ago, I saw an equation parser, written in c#, and using
regular expressions (I think!), but now I cannot recall where I saw
it- if anyone saw anything like this, could they please post the url?
>>From memory,
the parser not only dealt with operator precedence, but also the use
of brackets, so that any complicated expession could be re-written as
an equation that could be read from left-to-right, as a simple
sequence of sub-equations using basic operators, +,-,/,*

The reason why I ask is that I am anticipating user input into a form
as a string, and I need to convert it into
an equation. The user inputted expression could be something like (a+
(b-d)*(e-c))/f so I need to find a way to parse it.

TIA

Paul

Feb 15 '07 #3
One other comment is that there are commercial products that would
allow you to write code that would input a string like (a+(b-c)*(e-c)/
f, identify the unknowns a,b,c,d,e,f, and then allow your user to
input the values for these unknowns and finally compute the entered
expression.

=============== =============== =
Clay Burch
Syncfusion, Inc.

Feb 15 '07 #4
Are you looking for this ?

http://www.codeproject.com/csharp/RP...sionParser.asp

Regards,

Bart
Feb 15 '07 #5
On 15 Feb, 11:08, <wwrote:
Are you looking for this ?

http://www.codeproject.com/csharp/RP...sionParser.asp

Regards,

Bart
They weren't what I saw, but they're still very useful!

Thanks a million for the quick replies, they may just save my life :)

Best wishes

Paul

Feb 15 '07 #6
Taking a dependancy on powershell may not work for you, but would allow you
to invoke any expression you can do on the command line and also can use any
..net lib (i.e. system.math) or external lib. And you can script your host
with it too if needed.

--
William Stacey [C# MVP]
PCR concurrency library: www.codeplex.com/pcr
PSH Scripts Project www.codeplex.com/psobject
<tr************ ***@btinternet. comwrote in message
news:11******** **************@ k78g2000cwa.goo glegroups.com.. .
| Hi,
| A few months ago, I saw an equation parser, written in c#, and using
| regular expressions (I think!), but now I cannot recall where I saw
| it- if anyone saw anything like this, could they please post the url?
| >From memory,
| the parser not only dealt with operator precedence, but also the use
| of brackets, so that any complicated expession could be re-written as
| an equation that could be read from left-to-right, as a simple
| sequence of sub-equations using basic operators, +,-,/,*
|
| The reason why I ask is that I am anticipating user input into a form
| as a string, and I need to convert it into
| an equation. The user inputted expression could be something like (a+
| (b-d)*(e-c))/f so I need to find a way to parse it.
|
| TIA
|
| Paul
|
Feb 16 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6045
by: Sven Dzepina | last post by:
Hello people =) Has somebody a nice script, which can solve equations ? It would be super, if someone has an idea where I can get such a script / code in php. Thanks. Gretting!
1
1630
by: Russell Blau | last post by:
This is not really a Python question, but it does relate to a Python program I'm working on, so this seems like as good a place as any to ask for suggestions ... I'm working on a GUI application that lets the user enter an alegbraic equation and displays a nicely-formatted representation of the same equation (and then maybe does other stuff with it). The question is: if you have an equation containing terms such as x * y / z, which way...
20
8685
by: Brian Kazian | last post by:
Here's my problem, and hopefully someone can help me figure out if there is a good way to do this. I am writing a program that allows the user to enter an equation in a text field using pre-existing variables. They then enter numerical values for these variables, or can tell the program to randomize the values used within a certain bounds. My problem is taking in this equation they have written in the text field and converting it into...
9
8913
by: Stud Muffin | last post by:
Hey Basically, I'm trying to take objects created in microsoft word using equation editor (for creating clean looking math/physics equations) and putting them into some sort of webpage format. But they come out grossly unalligned and ugly when I try to directly copy and paste into microsoft frontpage 2000. Few things I could do is place them directly using x/y coord (which i don't know how to do), or just taking screenshots and use...
5
3253
by: gamehack | last post by:
Hi all, I was thinking about parsing equations but I can't think of any generic approach. Basically I have a struct called math_term which is something like: struct math_term { char sign; int constant; int x; int y;
5
3070
w33nie
by: w33nie | last post by:
My table is pretty well complete, but I would prefer it if the value for Points could be turned into a mathematical equation, and this equation would use the data from the other fields in the table to achieve a value. I want this done in phpMyAdmin 2.7, if possible, so that when I change the values in other fields, the Points variable changes, due to its equation. The equation I would want would be something like: "won * 3 + drawn * 1"...
6
14837
by: Trev17 | last post by:
Hello, I am new to C++ and i have tried for several hours to make a program my teacher has given me as a lab. Here is the Lab question: the roots of the quadratic equation ax^2 + bx + c = 0, a cannot equal 0 are given by the following formula -b + or - square root of (b^2 - 4ac) / 2a. If b^2 - 4ac = 0 then equation has a single root. if b^2 - 4ac > 0 then equation has two real roots. if b^2 - 4ac < 0 then equation has two complex...
10
2363
by: Constantine AI | last post by:
Hi i am having a little problem with an equation function that was created from all your help previously. The function works fine itself but with a small glitch within it. Here is the function code. Public Function fCalcEquation(strEquation As String) As Long Dim MyDB As DAO.Database Dim rstParameters As DAO.Recordset Dim intParamPosition As Integer Dim strParameter As String Dim strValue As String
2
3758
by: phoenix1990 | last post by:
so i have an entry frame where i want to input an equation, and i need to turn the string into an actual equation in terms of x. so that i can plot it on a canvas. i already know how to make the entry frame, and how to extract the string equation that was inputed. the only problem i'm having is converting it into an actual equation. e.g. the string input is 'sin(x)' and i want to turn it into sin(x) x is defined by another entry frame...
0
8238
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8174
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7164
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.