In order to descrive the multifractal behaviour of a set, Baumann provides a code based on the functions Dq and Tau, given below.
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 = -Dfractal /. result;
(*----collect the results in a list---*)
AppendTo[listrg, {q, result}], {q, -10, 10, .101}], Print[" "];
Print[" Lengths of lists are different!"];
listrg = {}];
listrg]
(*----calculate Tau---*)
Tau[result_list] :=
Block[{l1, listtau = {}},(*----lengths of the lists---*)
l1 = Length[result];
(*---calcultate Tau---*)
Do[AppendTo[
listtau, {result[[k, 1]],
result[[k, 2]] (1 - result[[k, 1]])}], {k, 1, l1}];
listtau];
p = {2/5, 2/5, 1/5};
r = {1/3, 1/3, 1/3};
ListDq = Dq[p, r];
ListLinePlot[ListDq, AxesLabel -> {"q", "Dq"}]
listTau = Tau[listDq];
ListLinePlot[listTau, Joined -> {True, False},
AxesLabel -> {"q", "\[Tau]"}, Prolog -> Thickness[0.001]]
The code above provides the plot of Dq but gives problems on Tau. In particular, the following errors are given:
Any ideas?
Answer
Two simple mistakes.
Tau[result_list] :=
should be Tau[result_List] :=
and
listTau = Tau[listDq];
should be listTau = Tau[ListDq];
Mathematica is case-sensitive. You must be careful about capitalization in identifiers.
Comments
Post a Comment