-2

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 ?

janhardo
  • 659
  • 3
  • 12
  • 2
    Please provide Mathematica code. – Ulrich Neumann Feb 09 '22 at 15:55
  • h is a pure Function with a single formal parameter \[Alpha]. – Bob Hanlon Feb 09 '22 at 15:58
  • 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? – xzczd Feb 10 '22 at 01:39
  • 1
    Then, to close voters: I don't think evaluation control in Mathematica (include but not limited to the usage of HoldAll) is simple. – xzczd Feb 10 '22 at 02:02
  • @xzczd The question asked is "How is this user-function h constructed?" and the answer is in the question, simply and clearly stated in a one-line construction of h. The question does not ask about evaluation control. The stated purpose of h is "To use further in Complex analyse," which is pretty broad and obscurely related to h; but it is pretty clearly not about evaluation control. Otherwise I agree that evaluation control is not simple. (If you have some insight that the OP has a particular question about evaluation control, perhaps you can help them express it.) – Michael E2 Feb 10 '22 at 15:42
  • I am a starter with MMA I do have some experience with Maple, but I have not been very strong in that either. If someone feels inclined to discuss all the details of this command is, it could be instructive. The application of the h : command is for study material in a friendlier format. What limitations does the h command have ? – janhardo Feb 10 '22 at 16:18
  • I don't know, and you do not state, what the purpose of h is. It seems to be a way to inspect OwnValues in a different format: https://i.stack.imgur.com/hZFzh.png -- Though unlike OwnValues, h won't complain if a is not a symbol. Maybe that's intentional, in which case I would expect == instead of =. Maybe the function's author wasn't concerned with such details. I have no way of knowing your or the author's purpose for h.... – Michael E2 Feb 10 '22 at 17:09
  • 1
    ...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. – Michael E2 Feb 10 '22 at 17:12
  • @Michael E2 thanks, I have worked out some study material from complex analysis in Maple. The first intention was to try to follow this study material in MMA to start learning MMA better. Have put an example question of this on the forum , but it was in traditional form what Maple code shows. It was also good for me to stay in the standard form of MMA at first. But the forum member also translated his "help" code for me to traditional form using the user- function h. Then my question came on the forum how exactly the function h is made, Later i can try to make my own user-function – janhardo Feb 10 '22 at 18:09
  • @Michael E2 In the pic you see a complex function f(z) in which a function value is entered This is done in a number of steps

    The user function h shows this in ordinary mathematical notation Hopefully you now see why the user function h can be used [link]https://www.dropbox.com/s/qkxh7blf2o9h210/Michael%20E2%20gebruik%20van%20%20user%20functie%20h.png?dl=0

    – janhardo Feb 10 '22 at 18:28

1 Answers1

4

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.

Daniel Huber
  • 51,463
  • 1
  • 23
  • 57
  • 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 – janhardo Feb 09 '22 at 18:49
  • @janhardo you could read others' questions, and see how they organize theirs. Also, read the document carefully. – AsukaMinato Feb 09 '22 at 19:57
  • @wuyudi, good hint to look to other questions : i looked at the question https://mathematica.stackexchange.com/questions/75927/how-can-a-function-know-in-which-function-it-was-evaluated?rq=1 Indeed i do see the style of questioning here

    I will try to question style into a new coming question , about a complex integral

    – janhardo Feb 09 '22 at 20:09
  • @ 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 – janhardo Feb 09 '22 at 20:49
  • No magic: TraditionalForm@HoldForm[ ....] is the same as TraditionalForm[HoldForm[ ....]] – Daniel Huber Feb 10 '22 at 13:24
  • @xzczd ..quote "I don't think evaluation control in Mathematica (include but not limited to the usage of HoldAll) is simple." I like to know more about this "evaluationcontrol" in MMA , how it works – janhardo Feb 10 '22 at 20:49