The problem is just the expansion of (1+x)^10000.

(1) -> )set message time on

(1) -> g(x) == (1+x)^10000
                                                                   Type: Void
                                                                  Time: 0 sec
(2) -> eval(D(g(x),x), x=0.1)
   Compiling function g with type Variable x -> Polynomial Integer

                                                       Type: Polynomial Float
                           Time: 3.09 (IN) + 6.74 (EV) + 0.06 (OT) = 9.89 sec

In FriCAS and OpenAxiom (probably Axiom too) the correct way to avoid
this is to treat (1+x) as a kernel via the identity operator 'paren'.

(3) -> g(x) == paren(1+x)^10000
   Compiled code for g has been cleared.
   1 old definition(s) deleted for function or rule g
                                                                   Type: Void
                                                                  Time: 0 sec
(4) -> eval(D(g(x),x), x=0.1)
   Compiling function g with type Variable x -> Expression Integer
                     9999      ,
   (4)  10000.0 (1.1)    %paren (1.1)

                                                       Type: Expression Float
                                       Time: 0.09 (IN) + 0.05 (OT) = 0.14 sec

The only trouble here is that neither FriCAS nor OpenAxiom know how to
differentiate this operator.  This can be fixed with the following
patch:

https://github.com/billpage/fricas/commit/04c1f9b2d5eb4ece95c6f5dded46a72181cecb06
https://github.com/billpage/fricas/commit/04c1f9b2d5eb4ece95c6f5dded46a72181cecb06.patch

(1) -> g(x) == paren(1+x)^10000
                                                                   Type: Void
                                                                  Time: 0 sec
(2) -> eval(D(g(x),x), x=0.1)
   Compiling function g with type Variable(x) -> Expression(Integer)

                     9999
   (2)  10000.0 (1.1)
                                                      Type: Expression(Float)
                           Time: 0.04 (IN) + 0.00 (EV) + 0.12 (OT) = 0.16 sec


On 9 March 2017 at 16:58, Mark Clements <mark.cleme...@ki.se> wrote:
> [Apologies for cross-posting]
>
> For the algorithmic differentiation: I have started an implementation
> (attached) of the jet machinery using a domain rather than the
> domain+package used in Smith et al.
>
> This provides considerably faster differentiation than symbolic
> differentiation. For example:
>
> g(x) == (1+x)^10000
> eval(D(g(x),x), x=0.1) -- slow
> g(jet(0.1)) -- fast!
>
> I was not certain how to get x=jet(1.0) or eval(x^x, x=jet(2.0)) to work:
> any suggestions?
>
> Sincerely, Mark,
>
>
> On 02/19/2017 12:21 PM, Gabriel Dos Reis wrote:
>
> It was available in a branch of OpenAxiom. Jacob wanted to rewrite for
> merging in the main trunk. He graduated and got a job, so did not get to
> rewrite it. I added the AST part of the work to the trunk, but the jet
> machinery remained in Jacob's branch.
>
> Jacob: do you still have that?
>
> -- Gaby
>
>
> On Feb 19, 2017 3:15 AM, "Mark Clements" <mark.cleme...@ki.se> wrote:
>
> Is the Axiom code for Smith's work on algorithmic differentiation
> available?
>
> http://www.axiomatics.org/~gdr/ad/issac07.pdf
> http://oaktrust.library.tamu.edu/bitstream/handle/1969.1/ETD-TAMU-2010-05-7823/SMITH-DISSERTATION.pdf
>
> Sincerely, Mark Clements.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> open-axiom-devel mailing list
> open-axiom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/open-axiom-devel
>
>
>
> --
> 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-de...@googlegroups.com.
> Visit this group at https://groups.google.com/group/fricas-devel.
> For more options, visit https://groups.google.com/d/optout.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to