how to parse standard algebraic notation

2014-09-30 Thread math math
Hi,

I am trying to learn Python while solving exercises. 

I want to basically write a program that inputs a polynomial in standard 
algebraic notation and outputs its derivative.

I know that I need to get the exponent somehow, but I am not sure how to 
accomplish this in python (3.3)

Do you have any ideas or suggestions? I don't want to use existing modules as 
this is meant to be a didactic experience.

Regards
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to parse standard algebraic notation

2014-10-01 Thread math math
On Tuesday, 30 September 2014 23:15:24 UTC+2, Gary Herron  wrote:
> On 09/30/2014 01:53 PM, math math wrote:
> 
> > Hi,
> 
> >
> 
> > I am trying to learn Python while solving exercises.
> 
> >
> 
> > I want to basically write a program that inputs a polynomial in standard 
> > algebraic notation and outputs its derivative.
> 
> >
> 
> > I know that I need to get the exponent somehow, but I am not sure how to 
> > accomplish this in python (3.3)
> 
> >
> 
> > Do you have any ideas or suggestions? I don't want to use existing modules 
> > as this is meant to be a didactic experience.
> 
> >
> 
> > Regards
> 
> 
> 
> This depends on things you have not yet told us.
> 
> 
> 
> In particular -- what "standard algebraic notation"?  For x-squared: 
> 
> x**2 ?  or perhaps  x^2 ?  or something else like some Unicode 
> 
> characters or HTML to get a small superscript 2 above an x.
> 
> 
> 
> Once you give an example of what your input looks like, we can start 
> 
> hashing out how to read it.
> 
> 
> 
> Gary Herron
> 
> 
> 
> -- 
> 
> Dr. Gary Herron
> 
> Department of Computer Science
> 
> DigiPen Institute of Technology
> 
> (425) 895-4418

Thanks Gary (and Chris),

I should have sent a sample expression indeed.

What would be a good starting strategy for writing a program to take the 
derivative of a polynomial expression, such as this below?:
"x**3 + x**2 + x + 1"

I am a bit confused about my overall strategy. Should one be writing a parser 
class to split the input on operators and then on the double asterisks? Are 
there more clever ways? Or is this something one should solve using 
mathematical formulas instead of parsing the characters?

I just wonder how a seasoned Pythonian would go about a problem like this 
without using a ready-made derivative function from some module.

Regards,
Felix
-- 
https://mail.python.org/mailman/listinfo/python-list


Thoughts on python classes to represent an ebook reader

2014-10-01 Thread math math
Hi,

I hope there are people here with strong OOP experience.

Which classes would an object-oriented python programmer create for the design 
of a e-book reader for example? I am not really interested in the code, just 
the OOP classes that would come to one's mind for a task like this.

It should allow users to buy new e-books, view their list of purchased books 
and read the books.

I have made an attempt of class diagram here "http://imgur.com/9TR2Tlm"; but I 
would be really glad to hear other opinions. I have not used any inheritance 
for example. I didn't know exactly where it would be handy and I also dont know 
if these classes are theoretically a good basis at all...

Thanks a lot for comments/feedback.
Felix



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to parse standard algebraic notation

2014-10-01 Thread math math
Thanks a lot, I will give this a shot.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thoughts on python classes to represent an ebook reader

2014-10-02 Thread math math
Thanks a lot. It is quite helpful to follow the thought process here.
Another person gave the example of 'Calibre', but I've found it
overwhelming and I couldn't find any UML diagram there (maybe not searched
hard enough).

Regards,
Felix
-- 
https://mail.python.org/mailman/listinfo/python-list