@rjf,

As much as possible I am trying to avoid reinventing the wheel. I have not 
even really written a parser. All I have done is extended the parser 
already written in SymPy to understand algebraic equalities that have both 
a lhs and a rhs. By leveraging what the SymPy team has done I got 
relatively robust manipulations and math display with less than 150 lines 
of code. It does not do everything, but provides almost exactly the tools 
needed for my use case with students at the undergraduate level. My initial 
target is for laboratory notebooks/exercises in general chemistry. The 
students will collect data and then have to manipulate some simple 
relations before substituting in values derived from the collected data. I 
am hoping this will reduce the problems I have trying to help students who 
do not precisely record their algebraic manipulations nor keep very good 
track of how they punch numbers into equations on their calculators. 
Jupyter notebooks using this code, SymPy and Python based data acquisition 
software should keep a more reliable record of what they have done. Maybe 
they will even be able to find the mistakes more easily without my 
assistance.

I understand you are a strong booster for Maxima. I have used SageMath for 
years and thus have taken advantage of Maxima's capabilities as they are 
called upon from SageMath. In my case there are a number of  issues that 
make Maxima a poorer choice than SymPy:

   1. The support code necessary to make it work in the python/Jupyter 
   environment does not seem to exist in an easy to install form (e.g. 
   SageMath)
   2. My research suggested that recreating or extracting the code to talk 
   to Maxima, would be much more involved than the simple extension of SymPy, 
   which I have developed.
   3. Sometimes as much fun as it is to drive a fancy sports car, a VW-bug 
   may be more appropriate and may prevent less experienced drivers from 
   having a disaster. See the discussion of branch choices and integrals in 
   SageMath, that I've been involved in here 
   <https://trac.sagemath.org/ticket/28431>. What presently happens is 
   correct, but confusing to those used to working in a specific domain (the 
   real domain for many physical scientists).
   
And yes, this was a learning experience. I now have a much better 
understanding of the approach SymPy takes to doing symbolic math.

Jonathan

On Monday, May 25, 2020 at 5:39:04 PM UTC-5, rjf wrote:
>
> It looks like you have written a recursive descent parser. And a display.
> If you were running Maxima on a Pi, (see sourceforge for download)
> you would have a parser and a display without writing it yourself.
>
>   Just looking at the code briefly, I think you have to decide
> if you actually meet your own specs.  I don't know what sympy will
> provide, so maybe it is really OK.
>
> For example,
>
> a*b*c*d*e = a*g*c*d*f
> divide by b*d  do you get
>
> a*c*e = a*g*c*f/b  ?
>
>
> or more seriously,  (x^2-1)/(x+1)   to get (x-1) ?
>
> I would be surprised if you were the first person to write
> a parser like this in Python, but it is a learning experience.
>
> Good luck.
>
>
>
>
>
> On Monday, May 25, 2020 at 12:49:09 PM UTC-7, Jonathan wrote:
>>
>> As promised here is a git repository 
>> <https://github.com/gutow/Algebra_with_Sympy> with a myBinder 
>> demonstration of what I have so far. Once I extend it to handling 
>> inequalities, it will more than meet my use case needs.
>>
>> Some have asked for more specifics. Here is a list of some of the more 
>> important requirements:
>>
>> 1) Can be installed in a plain vanilla python3 virtual environment via 
>> pip or simply as a python file to be loaded.
>> 2) Does not conflict with SymPy or NumPy.
>> 3) Will load and run fast enough to avoid user complaints on a Raspberry 
>> Pi. One initial use case is being combined with Pi data acquisition 
>> hardware and python tools for controlling them.
>> 4) Makes sense to scientists in the fields of Physics, Chemistry and 
>> Biology.
>>
>> Thanks,
>> Jonathan
>>
>> On Thursday, May 21, 2020 at 8:30:42 AM UTC-5, Jonathan wrote:
>>>
>>> Dear All,
>>>
>>> I have a use case where I need something lighter weight than the whole 
>>> of Sagemath. I think SymPy + the ability to handle math on symbolic 
>>> equations as Sagemath does it might be enough. Thus I wanted to see if I 
>>> could extract from Sagemath the code supporting math on symbolic 
>>> expressions and overlay that on SymPy or at least use that as a template. 
>>> Can somebody please point me to the place to start looking in the codebase?
>>>
>>> To make sure people understand what I am interested in, here is a simple 
>>> example of the ability I would like to extract:
>>> >>>eq1 = p*V==n*R*T
>>> >>>eq1
>>> p*V=n*R*T
>>> >>>eq2=eq1/V
>>> >>>eq2
>>> p=n*R*T/V
>>>
>>> Thanks,
>>> Jonathan
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/cc815676-d3a9-48a3-bf99-7e3e2f2734ac%40googlegroups.com.

Reply via email to