Skip to main content
added 133 characters in body
Source Link
image_doctor
  • 10.3k
  • 23
  • 41

Here is an alternate way of structuring the definition of your function that avoids the use of If completely by employing a combination of conditional expression evaluation and argument pattern matching:

j[x_, n_, l_] := 0 /; l < n
j[x_, l_, l_] := x^l
j[x_, n_, l_] := (1-x)/(1 + x^l)*(Sum[j[x, n-1-i,l]*x^i, {i,0,l-1}]) + x^l/(1+x^l)

And plotted:

Plot[j[x, 7, 7], {x, 0, 1}]

Mathematica graphics

Here is an alternate way of structuring the definition of your function:

j[x_, n_, l_] := 0 /; l < n
j[x_, l_, l_] := x^l
j[x_, n_, l_] := (1-x)/(1 + x^l)*(Sum[j[x, n-1-i,l]*x^i, {i,0,l-1}]) + x^l/(1+x^l)

And plotted:

Plot[j[x, 7, 7], {x, 0, 1}]

Mathematica graphics

Here is an alternate way of structuring the definition of your function that avoids the use of If completely by employing a combination of conditional expression evaluation and argument pattern matching:

j[x_, n_, l_] := 0 /; l < n
j[x_, l_, l_] := x^l
j[x_, n_, l_] := (1-x)/(1 + x^l)*(Sum[j[x, n-1-i,l]*x^i, {i,0,l-1}]) + x^l/(1+x^l)

And plotted:

Plot[j[x, 7, 7], {x, 0, 1}]

Mathematica graphics

deleted 35 characters in body
Source Link
image_doctor
  • 10.3k
  • 23
  • 41

Here is an alternate way of structuring the definition of your function:

j[x_, n_, l_] := 0 /; l < n
j[x_, l_, l_] := x^l
j[x_, n_, l_] := (1 - x)/(1 + x^l)*
                 (Sum[j[x, n - 1 - i, l]*x^i, {i, 0, l- 1}]) + x^l/(1 + x^l1+x^l)

And plotted:

Plot[j[x, 7, 7], {x, 0, 1}]

Mathematica graphics

Here is an alternate way of structuring the definition of your function:

j[x_, n_, l_] := 0 /; l < n
j[x_, l_, l_] := x^l
j[x_, n_, l_] := (1 - x)/(1 + x^l)*
                 (Sum[j[x, n - 1 - i, l]*x^i, {i, 0, l- 1}]) + x^l/(1 + x^l)

And plotted:

Plot[j[x, 7, 7], {x, 0, 1}]

Mathematica graphics

Here is an alternate way of structuring the definition of your function:

j[x_, n_, l_] := 0 /; l < n
j[x_, l_, l_] := x^l
j[x_, n_, l_] := (1-x)/(1 + x^l)*(Sum[j[x, n-1-i,l]*x^i, {i,0,l-1}]) + x^l/(1+x^l)

And plotted:

Plot[j[x, 7, 7], {x, 0, 1}]

Mathematica graphics

added 206 characters in body
Source Link
image_doctor
  • 10.3k
  • 23
  • 41

Here is an alternate way of structuring the definingdefinition of your function:

j[x_, n_, l_] := 30 /; l < n
j[x_, l_, l_] := 5x^l
j[x_, n_, l_] := j[x(1 - x)/(1 + x^l)*
                 (Sum[j[x, n - 1 - i, l]l]*x^i, {i, 0, l- 1}]) + x^l/(1 + x^l)

And plotted:

Plot[j[x, 7, 7], {x, 0, 1}]

Mathematica graphics

Here is an alternate way of structuring the defining of your function:

j[x_, n_, l_] := 3 /; l < n
j[x_, l_, l_] := 5
j[x_, n_, l_] := j[x, n - 1, l]

Here is an alternate way of structuring the definition of your function:

j[x_, n_, l_] := 0 /; l < n
j[x_, l_, l_] := x^l
j[x_, n_, l_] := (1 - x)/(1 + x^l)*
                 (Sum[j[x, n - 1 - i, l]*x^i, {i, 0, l- 1}]) + x^l/(1 + x^l)

And plotted:

Plot[j[x, 7, 7], {x, 0, 1}]

Mathematica graphics

Source Link
image_doctor
  • 10.3k
  • 23
  • 41
Loading