[GiNaC-list] ginsh as a subroutine?

John Fletcher J.P.Fletcher at aston.ac.uk
Thu Jun 23 15:08:12 CEST 2005


Date sent:      	Wed, 22 Jun 2005 23:45:19 +0200 (CEST)
From:           	"Richard B. Kreckel" <kreckel at ginac.de>
To:             	GiNaC discussion list <ginac-list at ginac.de>
Subject:        	Re: [GiNaC-list] ginsh as a subroutine?
Send reply to:  	Richard.Kreckel at ginac.de, GiNaC discussion list <ginac-list at ginac.de>
	<mailto:ginac-list-request at ginac.de?subject=unsubscribe>
	<mailto:ginac-list-request at ginac.de?subject=subscribe>

> On Wed, 22 Jun 2005, John Fletcher wrote:
> > I would like to be able to call a subroutine with a string e.g.
> >
> > "x+y"
> >
> > and receive back an ex object containing the expression and also a
> > map mapping "x" and "y" strings to symbol objects.
> 
> Well, ex::construct_from_string_and_lst(const string&, const ex&)
> expects you to provide the list of symbols.
> 

That one aborts if the symbol is not in the list.

I would prefer one which adds the missing symbols, and think that 
is best done as a map as there are not duplicate symbols with the 
same name.  For example, if I process

x = 1;

it will make a symbol "x" with a key of "x" and if I then process

y = x + 2;

with the same map it will add "y" in the same way.  I can always 
extract the symbols and also the names and e.g. make a list.

> > The example program ginsh does this internally.  I think it could be
> > added within the class for ex objects.  Has anyone done this?
> 
> That sounds like a promising project.  If it could parse strings like
> "expand((x+y)^2)", then this would be eminently useful for creating a
> decent interface for TeXmacs.  There are a number of alternatives how
> to interface TeXmacs, but I'm under the impression that the cleanest
> way is via a string parser right inside the library, as opposed to the
> one in ginsh or yet another one outside GiNaC proper.
> 
> Regards
>   -richy.
> -- 
> Richard B. Kreckel
> <http://www.ginac.de/~kreckel/>
> 
> 
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> http://thep.physik.uni-mainz.de/mailman/listinfo/ginac-list
> 

I take it then that this hasn't been done.

Thanks for the comments

John
-- 
Dr John P. Fletcher   Tel: (44) 121 204 3389 (direct line)
Chemical Engineering and Applied Chemistry (CEAC),
School of Engineering and Applied Science (SEAS),
Aston University, Aston Triangle, BIRMINGHAM B4 7ET  U.K.               
CEAC Web site http://www.ceac.aston.ac.uk/
FAX: (44) 121 204 3679






More information about the GiNaC-list mailing list