Hi Martin
> D2(f: POLY INT): POLY INT == z2*D(f, z2) + 1/2*z1^4*D(f, z2, 2) + z1^3*D(D(f,
> z2), z1) + 1/2*z1^2*D(f, z1, 2) + z1^3*D(f, z2)+z1^2*D(f,z1)+z2*f
Do you expect that to work?
What is the type of
1/2*z1^4*D(f,z2,2)
when f \in ZZ[z1,z2]?
Would you expect that to be again a polynomial with integer coefficients
if the only thing you know is that D: ZZ[z1,z2]->ZZ[z1,z2] ?
That FriCAS does not immediately complain about that function definition
is certainly due to its kindness. It will try to interpret/execute by
best efforts.
Your second version with type POLY(INT) -> POLY(FRAC INT) looks better,
but then hands over a POLY(FRAC INT) to D2 where D2 expects a POLY(INT)
in the recursion
> p2(0)==1; p2(n) == D2 p2(n-1)
Also that is a place for FriCAS to help with a retraction.
I agree that it is bad that FriCAS gets it wrong, but why haven't you
started with FRAC(INT) from the beginning or even use a more specific type?
Ralf
PS: Actually, it would be quite interesting if you can figure out what
really the reason for this failure is.
(1) -> P:=DMP([z1,z2],FRAC INT)
(1) DistributedMultivariatePolynomial([z1,z2],Fraction(Integer))
Type:
Domain
(2) -> D2(f: P): P == z2*D(f, z2) + 1/2*z1^4*D(f, z2, 2) + z1^3*D(D(f,
z2), z1) + 1/2*z1^2*D(f, z1, 2) + z1^3*D(f, z2)+z1^2*D(f,z1)+z2*f
Function declaration D2 : DistributedMultivariatePolynomial([z1,z2],
Fraction(Integer)) -> DistributedMultivariatePolynomial([z1,z2],
Fraction(Integer)) has been added to workspace.
Type: Void
(3) -> p2(0)==1; p2(n) == D2 p2(n-1)
Type: Void
(4) -> eval(p2 17, [z1=1, z2=1])
Compiling function D2 with type DistributedMultivariatePolynomial([
z1,z2],Fraction(Integer)) -> DistributedMultivariatePolynomial([
z1,z2],Fraction(Integer))
Compiling function p2 with type Integer ->
DistributedMultivariatePolynomial([z1,z2],Fraction(Integer))
Compiling function p2 as a recurrence relation.
(4) 47609742627231823142029
Type:
DistributedMultivariatePolynomial([z1,z2],Polynomial(Fraction(Integer)))
PPS: Actually the business seems odd. Where do the expressions differ in
the following session? Or did I make a mistake?
(1) -> D2(f: POLY INT): POLY INT == z2*D(f, z2) + 1/2*z1^4*D(f, z2, 2) +
z1^3*D(D(f, z2), z1) + 1/2*z1^2*D(f, z1, 2) + z1^3*D(f,
z2)+z1^2*D(f,z1)+z2*f
p2(0)==1; p2(n) == D2 p2(n-1)
D2chk(f: POLY INT): POLY FRAC INT == z2*D(f, z2) + 1/2*z1^4*D(f,z2, 2) +
z1^3*D(D(f, z2), z1) + 1/2*z1^2*D(f, z1, 2) + z1^3*D(f,z2)+z1^2*D(f,
z1)+z2*f
p2chk(0)==1; p2chk(n) == D2chk p2chk(n-1)
Function declaration D2 : Polynomial(Integer) -> Polynomial(Integer)
has been added to workspace.
Type: Void
(2) -> (2) ->
Type: Void
(3) -> (3) -> Function declaration D2chk : Polynomial(Integer) ->
Polynomial(
Fraction(Integer)) has been added to workspace.
Type: Void
(4) -> (4) ->
Type: Void
(5) -> (5) -> A16:=p2 16;
Compiling function D2 with type Polynomial(Integer) -> Polynomial(
Integer)
Compiling function p2 with type Integer -> Polynomial(Integer)
Compiling function p2 as a recurrence relation.
Type:
Polynomial(Integer)
(6) -> B16:=p2chk 16;
Compiling function D2chk with type Polynomial(Integer) -> Polynomial
(Fraction(Integer))
Compiling function p2chk with type Integer -> Polynomial(Fraction(
Integer))
Compiling function p2chk as a recurrence relation.
Type: Polynomial(Fraction(Integer))
(7) -> D2 A16 - D2chk B16
(7)
14 13 12 11 10 9 16 13
12
(2z1 + 8z1 + 17z1 + 14z1 + 5z1 + z1 )z2 + 4z1 + 32z1
+ 32z1
+
9
4z1
Type: Polynomial(Fraction(Integer))
(8) -> z2*D(A16, z2) - z2*D(B16,z2)
(8) 0
Type: Polynomial(Fraction(Integer))
(9) -> 1/2*z1^4*D(A16, z2, 2) - 1/2*z1^4*D(B16, z2, 2)
(9) 0
Type: Polynomial(Fraction(Integer))
(10) -> z1^3*D(D(A16, z2), z1) - z1^3*D(D(B16, z2), z1)
(10) 0
Type: Polynomial(Fraction(Integer))
(11) -> 1/2*z1^2*D(A16, z1, 2) - 1/2*z1^2*D(B16, z1, 2)
(11) 0
Type: Polynomial(Fraction(Integer))
(12) -> z1^3*D(A16, z2) - z1^3*D(B16, z2)
(12) 0
Type: Polynomial(Fraction(Integer))
(13) -> z1^2*D(A16,z1) - z1^2*D(B16,z1)
(13) 0
Type: Polynomial(Fraction(Integer))
(14) -> z2*A16 - z2*B16
(14) 0
Type: Polynomial(Fraction(Integer))
(16) -> A17 := z2*D(A16, z2) + 1/2*z1^4*D(A16, z2, 2) + z1^3*D(D(A16,
z2), z1) + 1/2*z1^2*D(A16, z1, 2) + z1^3*D(A16, z2) + z1^2*D(A16,z1);
Type: Polynomial(Fraction(Integer))
(17) -> B17 := z2*D(B16, z2) + 1/2*z1^4*D(B16, z2, 2) + z1^3*D(D(B16,
z2), z1) + 1/2*z1^2*D(B16, z1, 2) + z1^3*D(B16, z2) + z1^2*D(B16,z1);
Type: Polynomial(Fraction(Integer))
(18) -> A17-B17
(18) 0
Type: Polynomial(Fraction(Integer))
(19) -> C17:POLY(INT):=A17;
Type: Polynomial(Integer)
(21) -> C17-B17
(21) 0
Type: Polynomial(Fraction(Integer))
(22) -> a1:=z2*D(A16, z2);
Type: Polynomial(Integer)
(24) -> a2:=1/2*z1^4*D(A16, z2, 2);
Type: Polynomial(Fraction(Integer))
(25) -> b1:=z2*D(B16, z2);
Type: Polynomial(Fraction(Integer))
(27) -> b2:=1/2*z1^4*D(B16, z2, 2);
Type: Polynomial(Fraction(Integer))
(28) -> a3:=z1^3*D(D(A16, z2), z1);
Type: Polynomial(Integer)
(29) -> b3:=z1^3*D(D(B16, z2), z1);
Type: Polynomial(Fraction(Integer))
(44) -> a4:=1/2*z1^2*D(A16, z1, 2);
Type: Polynomial(Fraction(Integer))
(45) -> b4:=1/2*z1^2*D(B16, z1, 2);
Type: Polynomial(Fraction(Integer))
(46) -> a:=a1+a2+a3+a4;
Type: Polynomial(Fraction(Integer))
(47) -> b:=b1+b2+b3+b4;
Type: Polynomial(Fraction(Integer))
(48) -> a-b
(48) 0
Type: Polynomial(Fraction(Integer))
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---