Waldek Hebisch <[EMAIL PROTECTED]> writes:
> Is this really enough? Something like:
>
> DoD := LODO(EXPR INT, f+->D(f,x))
>
> lodoPower(x : DoD, n: NonNegativeInteger) == x^n
>
> should work. Currently the first line (assignment to DoD) fails,
> but assuming it worked I would expect lodoPower to use ^ which has the second
> argument beeing NonNegativeInteger and ignore versions which are defined only
> for PositiveInteger.
You are quite right. Many thanks! Below the new patch. I'm currently
rebuilding from scratch, so I cannot test really properly...
Martin
Index: src/algebra/ore.spad.pamphlet
===================================================================
--- src/algebra/ore.spad.pamphlet (revision 345)
+++ src/algebra/ore.spad.pamphlet (working copy)
@@ -475,6 +475,22 @@
++ outputForm(p, x) returns the output form of p using x for the
++ otherwise anonymous variable.
== SparseUnivariatePolynomial R add
+@
+
+We have to define \spadfun{**} and \verb|^|, because otherwise they would be
+taken from \spadtype{SUP R}, where the default implementations from
+\spadtype{SemiGroup} and \spadtype{Monoid} are overridden. There might be a
+faster definition, of course.
+
+<<domain ORESUP SparseUnivariateSkewPolynomial>>=
+ import RepeatedSquaring(%)
+ _^(x:%, n:PositiveInteger):% == x ** n
+ x:% ** n:PositiveInteger == expt(x,n)
+ _^(x:%, n:NonNegativeInteger):% == x ** n
+ x:% ** n:NonNegativeInteger ==
+ zero? n => 1
+ expt(x,n pretend PositiveInteger)
+
import UnivariateSkewPolynomialCategoryOps(R, %)
x:% * y:% == times(x, y, sigma, delta)
Index: src/input/bugs2008.input.pamphlet
===================================================================
--- src/input/bugs2008.input.pamphlet (revision 345)
+++ src/input/bugs2008.input.pamphlet (working copy)
@@ -80,6 +80,20 @@
testEquals("integrate(log(sqrt(1-x^2)/x)/(x^2), x)", "(-log(sqrt(1-x^2)/x)
-x*log(x+1)/2 + x*log(x-1)/2 + 1)/x")
+testcase "Skew exponentiation (issue #431)"
+Dx: LODO(EXPR INT, f+->D(f,x)) := D()
+u := operator 'u
+L := Dx + u(x)
+testEquals("L**2", "L*L")
+lodoPower(x: DoD, n: NonNegativeInteger): DoD == x^n
+testEquals("lodoPower(L, 3)", "L*L*L")
+
+f: INT->INT:=x+->x+1
+K := OREUP(x, INT, 1, f)
+M := x::K+1
+testEquals("M**2", "M*M")
+testEquals("M^3", "M*M*M")
+
)set output algebra on
statistics()
@
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---