From: Jens Vollinga Date: Sat, 9 Aug 2008 08:14:02 +0000 (+0200) Subject: Added polynomial factorization (univariate case). X-Git-Tag: release_1-5-0~86 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=d08150300eb98c6435a4c464c057ba2967a19c8f;hp=114449ae6f2cd3151d9b8342c570db021a9e892c Added polynomial factorization (univariate case). --- diff --git a/check/Makefile.am b/check/Makefile.am index a96dcfe7..a34bb9f3 100644 --- a/check/Makefile.am +++ b/check/Makefile.am @@ -15,6 +15,7 @@ EXAMS = exam_paranoia \ exam_differentiation \ exam_polygcd \ exam_normalization \ + exam_factor \ exam_pseries \ exam_matrices \ exam_lsolve \ @@ -97,6 +98,9 @@ exam_polygcd_LDADD = ../ginac/libginac.la exam_normalization_SOURCES = exam_normalization.cpp exam_normalization_LDADD = ../ginac/libginac.la +exam_factor_SOURCES = exam_factor.cpp +exam_factor_LDADD = ../ginac/libginac.la + exam_pseries_SOURCES = exam_pseries.cpp exam_pseries_LDADD = ../ginac/libginac.la diff --git a/ginac/Makefile.am b/ginac/Makefile.am index a74418c5..d2ef6145 100644 --- a/ginac/Makefile.am +++ b/ginac/Makefile.am @@ -3,7 +3,7 @@ lib_LTLIBRARIES = libginac.la libginac_la_SOURCES = add.cpp archive.cpp basic.cpp clifford.cpp color.cpp \ constant.cpp ex.cpp excompiler.cpp expair.cpp expairseq.cpp exprseq.cpp \ - fail.cpp fderivative.cpp function.cpp idx.cpp indexed.cpp inifcns.cpp \ + fail.cpp factor.cpp fderivative.cpp function.cpp idx.cpp indexed.cpp inifcns.cpp \ inifcns_trans.cpp inifcns_gamma.cpp inifcns_nstdsums.cpp \ integral.cpp lst.cpp matrix.cpp mul.cpp ncmul.cpp normal.cpp numeric.cpp \ operators.cpp power.cpp registrar.cpp relational.cpp remember.cpp \ @@ -15,7 +15,7 @@ libginac_la_LIBADD = $(DL_LIBS) ginacincludedir = $(includedir)/ginac ginacinclude_HEADERS = ginac.h add.h archive.h assertion.h basic.h class_info.h \ clifford.h color.h constant.h container.h ex.h excompiler.h expair.h expairseq.h \ - exprseq.h fail.h fderivative.h flags.h function.h hash_map.h idx.h indexed.h \ + exprseq.h fail.h factor.h fderivative.h flags.h function.h hash_map.h idx.h indexed.h \ inifcns.h integral.h lst.h matrix.h mul.h ncmul.h normal.h numeric.h operators.h \ power.h print.h pseries.h ptr.h registrar.h relational.h structure.h \ symbol.h symmetry.h tensor.h version.h wildcard.h diff --git a/ginac/ginac.h b/ginac/ginac.h index 4fe796e0..ad96e640 100644 --- a/ginac/ginac.h +++ b/ginac/ginac.h @@ -66,6 +66,8 @@ #include "color.h" #include "clifford.h" +#include "factor.h" + #include "excompiler.h" #ifdef __MAKECINT__ diff --git a/ginsh/ginsh.1.in b/ginsh/ginsh.1.in index 8172a54f..af18f4e7 100644 --- a/ginsh/ginsh.1.in +++ b/ginsh/ginsh.1.in @@ -290,6 +290,9 @@ detail here. Please refer to the GiNaC documentation. .BI expand( expression ) \- expands an expression .br +.BI factor( expression ) +\- factorizes an expression (univariate) +.br .BI find( expression ", " pattern ) \- returns a list of all occurrences of a pattern in an expression .br diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index e2913724..b8c6875a 100644 --- a/ginsh/ginsh_parser.yy +++ b/ginsh/ginsh_parser.yy @@ -330,6 +330,7 @@ static ex f_evalf1(const exprseq &e) {return e[0].evalf();} static ex f_evalm(const exprseq &e) {return e[0].evalm();} static ex f_eval_integ(const exprseq &e) {return e[0].eval_integ();} static ex f_expand(const exprseq &e) {return e[0].expand();} +static ex f_factor(const exprseq &e) {return factor(e[0]);} static ex f_gcd(const exprseq &e) {return gcd(e[0], e[1]);} static ex f_has(const exprseq &e) {return e[0].has(e[1]) ? ex(1) : ex(0);} static ex f_lcm(const exprseq &e) {return lcm(e[0], e[1]);} @@ -610,6 +611,7 @@ static const fcn_init builtin_fcns[] = { {"evalm", f_evalm, 1}, {"eval_integ", f_eval_integ, 1}, {"expand", f_expand, 1}, + {"factor", f_factor, 1}, {"find", f_find, 2}, {"fsolve", f_fsolve, 4}, {"gcd", f_gcd, 2},