Search code examples
pythonwolfram-mathematica

Trying to understand Mathematica's code and replicate in Python


I am trying to understand a Mathematica code so that I can replicate it in python:

My function in Mathematica -

Deulab[c_, yh1_, a_, b_] := {c - (EULab[c, yh1, a, b] - 1) * 0.3, yh1, a, b} where I have already defined EULab above.

What does the curly bracket mean and how can I interpret this code and then replicate it in python?

Mathematica

DDeulab[T_] := Deulab@@T

What is @@ T and what is it's equivalent in python?

Mathematica

Coab[yh_, a_, b_] := Last[NestList[DDeulab, {1, yh, a, b}, 50]][[1]]

What is Last[NestList][[1]] means and also it's equivalent in python?


Solution

  • Have you tried using the wolfram client?

    https://reference.wolfram.com/language/WolframClientForPython/

    and their reference docs?

    https://reference.wolfram.com/language/ref/List.html

    {a,b,c} represents a vector.

    But in this case you've 4 elements, so it looks like a list.

    https://reference.wolfram.com/language/ref/Apply.html

    @@ represents apply

    So that'd be applying a function, i.e. f[a,b,c,d]