* ot: parsing math equations
@ Tyler Spivey
` Glenn Ervinat home
` ot: " Owen Patrick Smith
0 siblings, 2 replies; 5+ messages in thread
From: Tyler Spivey @ UTC (permalink / raw)
To: speakup
sorry if this's off topic, but here goes:
i'm writing a program in python to do varius math things.
factoring, radicals, etc. but my major limitation is that it can't
do anything with algebra equations.
2x^2+3x+4x-x+3y
etc...
would a regular expression be the answer for breaking these down into there
component parts?
or do I need a full-blown parser for doing that?
probably the parser - but i'm not sure if any python based solutions exist.
they do, but I'm not sure if they are what i want.
i don't want to do any complex coding. this's just a spare-time project for
getting homework done faster, and i don't want to spend hours and hours on
it. it's currently topped almost 10k, but most of that are the docs
contained in one very long tripple-quoted string.
and all this coming from the guy who previously hated python without really
trying it first...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: parsing math equations
ot: parsing math equations Tyler Spivey
@ ` Glenn Ervinat home
` ot: " Owen Patrick Smith
1 sibling, 0 replies; 5+ messages in thread
From: Glenn Ervinat home @ UTC (permalink / raw)
To: speakup
Maybe using parenthesis would help.
----- Original Message -----
From: "Tyler Spivey" <tspivey8@softhome.net>
To: <speakup@braille.uwo.ca>
Sent: Monday, June 09, 2003 4:17 PM
Subject: ot: parsing math equations
sorry if this's off topic, but here goes:
i'm writing a program in python to do varius math things.
factoring, radicals, etc. but my major limitation is that it can't
do anything with algebra equations.
2x^2+3x+4x-x+3y
etc...
would a regular expression be the answer for breaking these down into there
component parts?
or do I need a full-blown parser for doing that?
probably the parser - but i'm not sure if any python based solutions exist.
they do, but I'm not sure if they are what i want.
i don't want to do any complex coding. this's just a spare-time project for
getting homework done faster, and i don't want to spend hours and hours on
it. it's currently topped almost 10k, but most of that are the docs
contained in one very long tripple-quoted string.
and all this coming from the guy who previously hated python without really
trying it first...
_______________________________________________
Speakup mailing list
Speakup@braille.uwo.ca
http://speech.braille.uwo.ca/mailman/listinfo/speakup
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ot: parsing math equations
ot: parsing math equations Tyler Spivey
` Glenn Ervinat home
@ ` Owen Patrick Smith
` Charles Crawford
1 sibling, 1 reply; 5+ messages in thread
From: Owen Patrick Smith @ UTC (permalink / raw)
To: speakup
the parenthesies and order of operations makes infix notation a pain to
parse automatically. Look into pre/post-fix notation. it looks wierd and
takes a bit to get used to but its much easier to parse. If you insist on
using infix try a series of regexps. Find the first set of parens and run
the algorithm recursively on just the parenthsied statement. Once you've
run out of parens to find then evaluate the highest priority operations.
repeat until you've run finished the whole string. Basically if you're
just trying to get some help with homework consider Maple, Mathematica or
similar, its probably easier.
HtH,
Owen
On Mon, 9 Jun 2003, Tyler Spivey wrote:
> sorry if this's off topic, but here goes:
> i'm writing a program in python to do varius math things.
> factoring, radicals, etc. but my major limitation is that it can't
> do anything with algebra equations.
> 2x^2+3x+4x-x+3y
> etc...
> would a regular expression be the answer for breaking these down into there
> component parts?
> or do I need a full-blown parser for doing that?
> probably the parser - but i'm not sure if any python based solutions exist.
> they do, but I'm not sure if they are what i want.
> i don't want to do any complex coding. this's just a spare-time project for
> getting homework done faster, and i don't want to spend hours and hours on
> it. it's currently topped almost 10k, but most of that are the docs
> contained in one very long tripple-quoted string.
> and all this coming from the guy who previously hated python without really
> trying it first...
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ot: parsing math equations
` ot: " Owen Patrick Smith
@ ` Charles Crawford
` Chuck Hallenbeck
0 siblings, 1 reply; 5+ messages in thread
From: Charles Crawford @ UTC (permalink / raw)
To: speakup
I am not familiar with Pithon, but when I program, I store the input to a
variable and querry it for the result. Hence, input " Enter what you want
done: " to mymath
? mymath
return
--
-- Charlie Crawford
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ot: parsing math equations
` Charles Crawford
@ ` Chuck Hallenbeck
0 siblings, 0 replies; 5+ messages in thread
From: Chuck Hallenbeck @ UTC (permalink / raw)
To: speakup
I have generally found that the "bc" program has all the math
smarts I normally need.
On Tue, 10 Jun 2003, Charles Crawford wrote:
> I am not familiar with Pithon, but when I program, I store the input to a
> variable and querry it for the result. Hence, input " Enter what you want
> done: " to mymath
> ? mymath
> return
>
>
>
> --
> -- Charlie Crawford
>
>
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
--
The Moon is Waxing Gibbous (79% of Full)
So visit me sometime at http://www.mhonline.net/~chuckh
My public encryption key is posted on that site
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~ UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
ot: parsing math equations Tyler Spivey
` Glenn Ervinat home
` ot: " Owen Patrick Smith
` Charles Crawford
` Chuck Hallenbeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).