Slawomir Kolodynski wrote: > > I am learning FriCAS so please excuse my basic questions and point me to > better place to ask them is such exists. > > FriCAS is able to evaluate some integrals in terms of the Gauss error > function (erf). For example > > (1/(sqrt(2*%pi)))*integrate(exp(-t^2/2),t=%minusInfinity..x) > > returns an expression involving erf. I would prefer such integrals to be > evaluated in terms of cumulative distribution function of the standard > normal distribution. > To achieve that I tried to define a rewriting rule > > phirule: rule erf(%x)==2*N(x*sqrt(2))-1 > > hoping that applying that on the result of integration will express the > result in terms of N (the CDF of standard normal). However, I get > > rule(erf(QUOTE(%x)),2*applyQuote(QUOTE(N),QUOTE(x)*sqrt(2))-1,[ > QUOTE(N)]) is not a valid type. > > when I try to define the rule. > What I am doing wrong when defining the rule?
1) ':' means type declaration. You need ':=' for assignment 2) You need to declare 'N' befor use Below is working version: (1) -> N := operator 'N (1) N Type: BasicOperator (2) -> phirule := rule erf(%x)==2*N(x*sqrt(2))-1 +-+ (2) erf(%x) == 2 N(x\|2 ) - 1 Type: RewriteRule(Integer,Integer,Expression(Integer)) (3) -> (1/(sqrt(2*%pi)))*integrate(exp(-t^2/2),t=%minusInfinity..x) +-+ x +-+ +---+ (\|2 erf(----) + \|2 )\|%pi +-+ \|2 (3) ---------------------------- +-----+ 2 \|2 %pi Type: Expression(Integer) (4) -> phirule(%) +-+ +-+ +---+ \|2 N(x\|2 )\|%pi (4) ------------------ +-----+ \|2 %pi Type: Expression(Integer) Note that for FriCAS 'N' is an arbitrary functions with unknown properties. The first line tells FriCAS that 'N' is being used as function name (operator), otherwise FriCAS would complain about undefined function. -- Waldek Hebisch -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To post to this group, send email to fricas-devel@googlegroups.com. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.