4

Following an old post, I have tried to make a function that calculates the Jackson integral of $q$-calculus:

Clear[JacksonIntegral]; 
JacksonIntegral[f_[x_], q_, b_] := (1 - q) b Sum[q^j f[q^j b], {j, 0, ∞}]

When applied to

A[x_] := x^.25

I have no complaint but no evaluation. More generally, how could I make a new rule in Mathematica?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
cyrille.piatecki
  • 4,582
  • 13
  • 26

1 Answers1

6

Your code should work with a small tweak. You just need to use the name of the function instead and input the name of the function or a pure function:

jacksonIntegral[f_, q_, b_] := (1 - q) b Sum[q^j f[q^j b], {j, 0, ∞}]
a[x_] := x^.25
jacksonIntegral[a, 1/2, 0.1]
(* 0.0485152 *)
jacksonIntegral[#^0.25 &, 1/2, 0.1]
(* 0.0485152 *)

Alternatively,

Clear[jacksonIntegral]
SetAttributes[jacksonIntegral, HoldFirst];
jacksonIntegral[f_[x_], q_, b_] := (1 - q) b Sum[q^j f[x] /. x -> q^j b, {j, 0, \[Infinity]}]
a[x_] := x^.25
jacksonIntegral[a[x], 1/2, 0.1]
(* 0.0485152 *)
march
  • 23,399
  • 2
  • 44
  • 100