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$

closed as off-topic by Bob Hanlon, José Antonio Díaz Navas, bbgodfrey, PlatoManiac, Johu Jan 23 at 14:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, José Antonio Díaz Navas, bbgodfrey, PlatoManiac
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ list -> List? $\endgroup$ – Kuba Jan 17 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 Jan 17 at 12:40
  • $\begingroup$ It does not work. Any other idea? $\endgroup$ – Spook82 Jan 18 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 Jan 18 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 Jan 19 at 12:30
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$
  • $\begingroup$ Thanks a lot. It finally works!!! $\endgroup$ – Spook82 Jan 20 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 Jan 20 at 23:21
  • $\begingroup$ Is it correct? You solved a big problem! $\endgroup$ – Spook82 Jan 21 at 20:01
  • $\begingroup$ @Spook82. Yes, your acceptance has been registered. $\endgroup$ – m_goldberg Jan 21 at 21:49

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