Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 9th, 2003, 04:44 PM
heinrich's Avatar
heinrich heinrich is offline
digital sinner
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: sinner's land
Posts: 68 heinrich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 37 m 30 sec
Reputation Power: 6
Send a message via Yahoo to heinrich
maths formula

how could i store a mathematical expression? in a logical way...maybe using some graphs? any suggestions or links?

Reply With Quote
  #2  
Old August 11th, 2003, 11:39 AM
SlankenOgen SlankenOgen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: The Netherlands
Posts: 122 SlankenOgen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
What's the expression?
__________________
~mgb

Reply With Quote
  #3  
Old August 11th, 2003, 11:51 AM
heinrich's Avatar
heinrich heinrich is offline
digital sinner
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: sinner's land
Posts: 68 heinrich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 37 m 30 sec
Reputation Power: 6
Send a message via Yahoo to heinrich
not a particular expression! how does an equation editor store the data, for example?

Reply With Quote
  #4  
Old August 11th, 2003, 12:01 PM
SlankenOgen SlankenOgen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: The Netherlands
Posts: 122 SlankenOgen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
You could try unicode. That has code for mathematical symbols I believe.

Reply With Quote
  #5  
Old August 11th, 2003, 01:13 PM
SolarBear's Avatar
SolarBear SolarBear is offline
onCsdfeu
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Canada
Posts: 100 SolarBear User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 7 m 43 sec
Reputation Power: 6
Send a message via ICQ to SolarBear Send a message via MSN to SolarBear
If you've got the space and resources, a simple way would be to get some mathematical software, like Mathematica, Maple or MATLAB. They're expensive, but well worth it.

Reply With Quote
  #6  
Old August 11th, 2003, 02:04 PM
heinrich's Avatar
heinrich heinrich is offline
digital sinner
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: sinner's land
Posts: 68 heinrich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 37 m 30 sec
Reputation Power: 6
Send a message via Yahoo to heinrich
i'm interested in the way they store mathematical data, like equations in their programs.

Reply With Quote
  #7  
Old August 11th, 2003, 02:17 PM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Click here for more information
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 35 m 6 sec
Reputation Power: 76
The programs all store equations by writing to the hard drive...
I think you might want to try to be a bit more informative in your question, I'm not sure what you're getting at.

Reply With Quote
  #8  
Old August 11th, 2003, 03:17 PM
dog135's Avatar
dog135 dog135 is offline
Doggie
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Location: Seattle, WA
Posts: 751 dog135 User rank is Corporal (100 - 500 Reputation Level)dog135 User rank is Corporal (100 - 500 Reputation Level)dog135 User rank is Corporal (100 - 500 Reputation Level)dog135 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 10 h 38 m 25 sec
Reputation Power: 7
It's often stored in reverse polish notation as well as plain text.

ie:
5-(x-y)+3
5xy--3+
read as:
push 5
push x
push y
subtract
subtract
push 3
add

pushes are done onto a stack, operators pop the last two values, do their operation, then push the answer back on.

Is this what you're looking for?

Reply With Quote
  #9  
Old August 11th, 2003, 05:22 PM
heinrich's Avatar
heinrich heinrich is offline
digital sinner
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: sinner's land
Posts: 68 heinrich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 37 m 30 sec
Reputation Power: 6
Send a message via Yahoo to heinrich
no ... i'm looking for a method to store a mathematical expression in memory...i was thinking graphs.

Reply With Quote
  #10  
Old August 11th, 2003, 06:59 PM
epl epl is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Dublin
Posts: 413 epl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 18 m 18 sec
Reputation Power: 8
i'm not sure what the terminology is - but you use a binary tree with a main node for the final operator to be processed and the left and right nodes representing the operands / sub equations similarly / recursively ... i don't really know how to explain it.

a simple example: 3+7*4 would look like this
Code:
 +
/ \
3 *
 / \
 7 4
and you can use this structure to parse, store and evaluate expressions in unary and binary operators

is that any help?

Reply With Quote
  #11  
Old August 12th, 2003, 05:06 AM
heinrich's Avatar
heinrich heinrich is offline
digital sinner
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: sinner's land
Posts: 68 heinrich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 37 m 30 sec
Reputation Power: 6
Send a message via Yahoo to heinrich
that's what i was thinking also....but could u help me with som URLs?

Reply With Quote
  #12  
Old August 12th, 2003, 12:57 PM
aragon
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
MathML is potentially a very good way of storing the forumlae for long term. That's what it was designed for.

URL

In memory you could use an binary tree as mentioned earlier (though for certain math expressions you might need an M-way tree). To compute the result you do a traversal.

An alternative to an M-way tree is to specify that a complex expression has to have a leaf node <two-args> which contains 2 arguments. This is a cludge.

Look up m-way trees, Binary trees and Abstract Syntax Trees (ASTs) in google. They are very common data structures documented everywhere.

You could also manipulate the MathML document tree with dom or sax.

HTH,
Aragon

Reply With Quote
  #13  
Old August 12th, 2003, 01:00 PM
aragon
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
This looks good like a good place to start looking for MathML links (the standards are good for reference but not for learning), in particular the second and sixth entries...

MathML at Google

Reply With Quote
  #14  
Old August 12th, 2003, 08:42 PM
hockeyrocksca hockeyrocksca is offline
i'm nothing
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 70 hockeyrocksca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 44 sec
Reputation Power: 6

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > maths formula


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |