@@ -155,6 +155,21 @@ using Base: oneto
155155 @test sum (f) ≈ 10.546408460894801 # empirical
156156 end
157157
158+ @testset " diff" begin
159+ P = RectPolynomial (Legendre (),Legendre ())
160+ f = expand (P, splat ((x,y) -> 1 ))
161+ @test diff (f,(1 ,0 ))[SVector (0.1 ,0.2 )] == diff (f,(0 ,1 ))[SVector (0.1 ,0.2 )] == 0.0
162+ f = expand (P, splat ((x,y) -> x))
163+ @test diff (f,(1 ,0 ))[SVector (0.1 ,0.2 )] == 1.0
164+ @test diff (f,(0 ,1 ))[SVector (0.1 ,0.2 )] == 0.0
165+ f = expand (P, splat ((x,y) -> cos (x* exp (y))))
166+ @test diff (f,(1 ,0 ))[SVector (0.1 ,0.2 )] ≈ - sin (0.1 * exp (0.2 ))* exp (0.2 )
167+ @test diff (f,(0 ,1 ))[SVector (0.1 ,0.2 )] ≈ - 0.1 * sin (0.1 * exp (0.2 ))* exp (0.2 )
168+ @test diff (f,(2 ,0 ))[SVector (0.1 ,0.2 )] ≈ - cos (0.1 * exp (0.2 ))* exp (0.4 )
169+ @test diff (f,(1 ,1 ))[SVector (0.1 ,0.2 )] ≈ - sin (0.1 * exp (0.2 ))* exp (0.2 ) - 0.1 * cos (0.1 * exp (0.2 ))* exp (0.4 )
170+ @test diff (f,(0 ,2 ))[SVector (0.1 ,0.2 )] ≈ - 0.1 * sin (0.1 * exp (0.2 ))* exp (0.2 ) - 0.1 ^ 2 * cos (0.1 * exp (0.2 ))* exp (0.4 )
171+ end
172+
158173 @testset " KronTrav bug" begin
159174 W = Weighted (Ultraspherical (3 / 2 ))
160175 D² = diff (W)' diff (W)
0 commit comments