0
$\begingroup$

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:

enter image description here

Any ideas?

$\endgroup$
5
  • 2
    $\begingroup$ list -> List? $\endgroup$
    – Kuba
    Commented Jan 17, 2019 at 12:32
  • $\begingroup$ As I undestood, I should try with Tau[result_List] := in instead of Tau[result_list] :=. Can it work? $\endgroup$
    – Spook82
    Commented Jan 17, 2019 at 12:40
  • $\begingroup$ It does not work. Any other idea? $\endgroup$
    – Spook82
    Commented Jan 18, 2019 at 9:16
  • 3
    $\begingroup$ "I does not work" - is meaningless. Please update the question with correct code, test example and explanation why it does not fit your expectations. $\endgroup$
    – Kuba
    Commented Jan 18, 2019 at 9:19
  • $\begingroup$ I want to say that the package gives me the following error: "ListLinePlot: Private`listTau is not a list of numbers or pairs of numbers'." It seems that there is an error in listTau. If you want to see the whole code, see mathematica.stackexchange.com/questions/188070/… $\endgroup$
    – Spook82
    Commented Jan 19, 2019 at 12:30

1 Answer 1

0
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ Thanks a lot. It finally works!!! $\endgroup$
    – Spook82
    Commented Jan 20, 2019 at 19:23
  • $\begingroup$ @Spook82. I'm glad you find my answer useful. Please consider accepting it. You can do that by clicking on the check mark that appears on the left of the answer below the down arrow. $\endgroup$
    – m_goldberg
    Commented Jan 20, 2019 at 23:21
  • $\begingroup$ Is it correct? You solved a big problem! $\endgroup$
    – Spook82
    Commented Jan 21, 2019 at 20:01
  • $\begingroup$ @Spook82. Yes, your acceptance has been registered. $\endgroup$
    – m_goldberg
    Commented Jan 21, 2019 at 21:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.