4
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ I'm positive this one is a duplicate now. Possible duplicate. $\endgroup$ Commented Mar 19, 2016 at 23:03
  • 1
    $\begingroup$ I removed the first sentence, only because this is certainly not a dumb question. $\endgroup$ Commented Mar 20, 2016 at 9:10

1 Answer 1

6
$\begingroup$

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 *) 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.