Hi GiNaC's authors! I'm using GiNaC in project for simplifying and normalizing math expressions (and physics, hereafter). My program checks student's solution of math or physics problem without teacher help (teacher need to enter some variants of solution only once). This program will be used for Distant Learning. So, I need to compare two different expressions on identity. I've found out some bugs (or features?) in new version of GiNaC 0.7.0 There they are: When I'm entering command like this:
normal(a^b*a^c, 2); in ginsh or simple c++ code, GiNaC stops to work or exits by Segmentation fault (there is no output).
If normalization level == 1, the result is: a^b*a^c. But I need a^(b+c)! Could you explain to me what must I do to correct this? And I have some questions about GiNaC. 1. If I need to normalize expression (a+b)^2 and result must be a^2+b^2+2*a*b. Have I need to call only normal() method or expand() also? 2. Do you planning to include some simple operations with vectors in GiNaC? Also, I'd like to help you in extending GiNaC. Therefore I'll examine GiNaC's sources and try to write some additional code... --------------------------------------- Machine configuration: Red Hat Linux release 7.0 (Guinness) Kernel 2.2.16-22 on an i586 Linux host.domain 2.2.16-22 #1 Tue Aug 22 16:16:55 EDT 2000 i586 unknown gcc version: 2.96 glibc-2.1.92-14 libc-5.3.12-31 GiNaC-0.7.0 cln-1.1 -- With best regards, Eugene Gorshkov aka Atany .. e-mail: atany@ic.kharkov.ua --- XEmacs 21.1 "Channel Islands" (linux)
Hi! On Sat, Jan 06, 2001 at 03:45:36PM +0200, Eugene Gorshkov wrote:
When I'm entering command like this:
normal(a^b*a^c, 2); in ginsh or simple c++ code, GiNaC stops to work or exits by Segmentation fault (there is no output).
This is fixed now in CVS (meaning it doesn't crash any more). But "normal()" only works on rational functions and it will leave expressions such as those above unmodified. BTW, the second parameter to normal() can usually be omitted; it will normalize the whole expression then.
But I need a^(b+c)!
I don't think that there's currently a way to do this with GiNaC (i.e. it doesn't do a^b*a^c -> a^(b+c)). Theoretically, you should be able to expand(a^(b+c)) and get a^b*a^c but this doesn't seem to be implemented yet. I will have a look at this.
1. If I need to normalize expression (a+b)^2 and result must be a^2+b^2+2*a*b. Have I need to call only normal() method or expand() also?
expand() is what you want here. normal() leaves this expression as it is. For a more detailed explanation of what normal() does and what it doesn't, see the GiNaC tutorial (section "Rational Expressions").
2. Do you planning to include some simple operations with vectors in GiNaC?
Yes.
Also, I'd like to help you in extending GiNaC.
Any help is greatly appreciated. Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/
participants (2)
-
Christian Bauer
-
Eugene Gorshkov