-2
$\begingroup$

strong textThe use of this function h is to transform expressions into traditional form.

To use further in Complex analyse

h = Function[a, (TraditionalForm[HoldForm[a = #1]] & )[a], HoldAll];

applied for a complex function

f[z_] := Expand[z^4];

h[f[z]]

How is this pure function h made ?

$\endgroup$
10
  • 2
    $\begingroup$ Please provide Mathematica code. $\endgroup$ Commented Feb 9, 2022 at 15:55
  • $\begingroup$ h is a pure Function with a single formal parameter \[Alpha]. $\endgroup$
    – Bob Hanlon
    Commented Feb 9, 2022 at 15:58
  • $\begingroup$ Well, you should have put a bit more effort in formatting your question. Posting a screenshot of the code without the corresponding code text is one of the worst thing to do in this site. Also, as mentioned before, you should make the question more focused, the code sample should be minimal. In this case, why not omitting the last 3 lines of code? $\endgroup$
    – xzczd
    Commented Feb 10, 2022 at 1:39
  • 1
    $\begingroup$ Then, to close voters: I don't think evaluation control in Mathematica (include but not limited to the usage of HoldAll) is simple. $\endgroup$
    – xzczd
    Commented Feb 10, 2022 at 2:02
  • 1
    $\begingroup$ ...I'd recommend spending time reviewing "Core Language" in this tutorial or in this book (esp. Ch. 2, 5, 6, 7). I think it would help you with all your questions if you had a better overall idea what Function, HoldForm, ./ w/ rules (ReplaceAll), and so forth mean, than to ask about one little bit, latch onto it, then get confused because only a partial explanation was given. $\endgroup$
    – Michael E2
    Commented Feb 10, 2022 at 17:12

1 Answer 1

4
$\begingroup$

To understand "h" you must realize that h contains 2 functions. The outer function has an argument: "a" and the attribute "HoldAll". Therefore, inside this function "a" is replaced by the unevaluated argument. E.g. if the argument is f[x+ I y] we will have:

Function[{a}, 
 TraditionalForm@HoldForm[h[f[x + I y]] = #] &@h[f[x + I y]], HoldAll]

Now we have the inner function, that does not have an attribute. It therefore evaluates its argument "h[f[x + I y]" and the result is replaced inside the HoldForm:

HoldForm[h[f[x + I y]] = x^4 + 4 I x^3 y - 6 x^2 y^2 - 4 I x y^3 + y^4]

Subsequently, "TraditionalForm" does its job.

$\endgroup$
6
  • $\begingroup$ i do see -2 Votes? this question does not show any reseach effort, it is unclear or not useful That's not true , because last two weeks when i started as new user with MMA i learned the handling in MMA with cells and more and invest time to learn more in MMA What for a research do you expect then and why it is not useful ..tell me $\endgroup$
    – janhardo
    Commented Feb 9, 2022 at 18:49
  • $\begingroup$ @janhardo you could read others' questions, and see how they organize theirs. Also, read the document carefully. $\endgroup$ Commented Feb 9, 2022 at 19:57
  • $\begingroup$ @wuyudi, good hint to look to other questions : i looked at the question mathematica.stackexchange.com/questions/75927/… Indeed i do see the style of questioning here I will try to question style into a new coming question , about a complex integral $\endgroup$
    – janhardo
    Commented Feb 9, 2022 at 20:09
  • $\begingroup$ @ Daniel Huber, thanks Thanks, in general terms the working of the function h is quite clear now. I need to study the pure function further to know how exactly the function h is defined with all the symbols in it Take this: f@expr ( prefix function on expression ) ,this expression TraditionalForm@HoldForm[ ....] for instance is difficult to understand now $\endgroup$
    – janhardo
    Commented Feb 9, 2022 at 20:49
  • $\begingroup$ No magic: TraditionalForm@HoldForm[ ....] is the same as TraditionalForm[HoldForm[ ....]] $\endgroup$ Commented Feb 10, 2022 at 13:24

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