I'm trying to use this multifractal package, which is included in the classic book by Baumann – Mathematica for Theoretical Physics II. The problem is that the code is not working, that is, I have no charts. In my idea, this package could help with fractal modeling. Unfortunately it does not work. The problem is that I have not found a mistake. I reported the code below. Can you help me?

```
begin package["MultiFractal`"];
clear[Dq, Tau, Alpha, MultiFractal];
MultiFractal :: usage = "MultiFractal[p_List,r_List] calculates that
multifractal spectrum D_q for a model based on the probabilities
p and the scaling factors r. This feature records five functions
Tau (q), D_q (q), Alpha (q), f (q) and f (alpha). ";
begin["Private`"];
(* --- Calculate the multifractal dimensions --- *)
dq[p_List, r_List] : =
block[{l1, l2, listrg = {}},(*---length of the lists---*)
l1 = Length[p]; l2 = length[r];
If[l1 == l2,(*---variation of q and determination of D_q---*)
Do[gl1 = Sum[p[[j]]^ q r[[j]]^ ((q - 1) Dfractal), {j, 1, l1}]- 1;
Result = FindRoot[gl1 == 0, {Dfractal, -3, 3}];
Result = -Defractal /. Result;
(* --- collect the result in a list ---- *)
attach[listrg, {q, result}], {q, -10, 10, .101}], To press[" "];
To press[" Lengths of lists are different!"];
listrg = {}];
listrg];
(* ---- calculated dew --- *)
dew[result_list] : =
block[{l1, listtau = {}},(*----lengths of the lists---*)
l1 = Length[result];
(* --- calculate Tau --- *)
Do[AppendTo[
listtau, {result[[k, 1]],
Result[[k, 2]](1 - result[[k, 1]])}], {k, 1, l1}];
listtau];
(* --- Legendre transformation --- *)
alpha[result_List] : =
block[{l1, dq, listalpha = {}, listf = {}, listleg = {}, mlist = {},
pl1, pl2},(*---lengths of the lists---*)l1 = Length[result];
(* --- determine the differential dq --- *)
dq = (result[[2, 1]]- Result[[1, 1]]2;
(* --- calculate alpha by numerical differentiation --- *)
Do[AppendTo[
listalpha, {result[[k,
1]](Result[[k + 1, 2]]- Result[[k - 1, 2]]) / dq}], {k, 2,
l1 - 1}];
l1 = length[listalpha];
(* --- compute f and put the result in a list --- *)
Do[AppendTo[
listf, {result[[k,
1]], - (Result[[k, 1]]List Alpha[[k, 2]]- Result[[k, 2]])}];
List Alpha[[k, 2]]= -listalpha[[k, 2]], {k, 1, 12}];
(* --- List of Legendre Transformations --- *)
Do[Append[Listleg{listalpha[AppendTo[Listleg{listalpha[Anhängen[listleg{listalpha[AppendTo[listleg{listalpha[[k, 2]]listf[[k, 2]]}];
attach[mlistlistf[mlistlistf[mlistlistf[mlistlistf[[k, 2]]], {k, 1, l2}];
(* --- pl f and alpha against q --- *)
pl1 = ListLinePlot[listalpha, Joined -> {True, False},
AxesLabel -> {"q", "[Alpha]"}, Prologue -> Thickness[0.001]];
pl2 = ListLinePlot[listf, Joined -> {True, False},
AxesLabel -> {"q", "f"}, Prologue -> Thickness[0.001]];
show[{pl1, pl2}, AxesLabel -> {"q", "[Alpha], f "}];
(* --- plot the Legendre transformation f against Alpha --- *)
ListLinePlot[listleg, AxesLabel -> {"[Alpha]"," f "}];
(* --- print the maximum of f = D_ 0 --- *) maxi = max[mlist];
To press[" "];
To press[" D_0 = ", maxi]];
(* --- Calculate the multifractal properties --- *)
Multifractal[p_List, r_List] : =
block[{listDq, listTau},(*---determine D_q---*)listDq = Dq[p, r];
ListLinePlot[listDq, Joined -> {True, False},
AxesLabel -> {"q", "Dq"}, Prologue -> Thickness[0.001]](* --- calculate Tau --- *) listTau = Tau[listDq];
ListLinePlot[listTau, Joined -> {True, False},
AxesLabel -> {"q", "[Tau]"}, Prologue -> Thickness[0.001]](* --- Determine the hoarding exponent --- *) Alpha[listTau]];
The End[];
final packet[];
```