1

I have some calculations with an arbitrary function. In the output, Mathematica always shows the function arguments. I would like to tidy the notation a bit, by hidding the arguments in the output. How can I do that? Or even better, is there a way to write the function arguments just once in the code? Remembering it's an arbitrary function.

For example, its something like this:

f[x,y] + (f[x,y])^2 = ...

And I prefer like this:

f + f^2 = ...

Thanks!

1 Answer 1

1

You mean just for display purposes? May be a simple /. ?

Clear[x, y, f]
expr = f[x, y] + (f[x, y])^2 == 34;
expr /. f[__] -> f

gives

Out[29]= f + f^2 == 34

You can even modify $PrePrint to do this automatically

Clear[x,y,f]
$PrePrint=#/.f[__]->f&;
expr=f[x,y]+(f[x,y])^2==34

Out[6]= f+f^2==34

expr
Out[7]= f+f^2==34

To get it back, do

$PrePrint=.
expr

Out[10]= f[x,y]+f[x,y]^2==34

I am not brave enough to do this myself in actual programming, but it is there to try.

Sign up to request clarification or add additional context in comments.

1 Comment

How to make a function to do the work, out of the first suggestion? So it replaces every occurrence of any function in my expression? I'm new to Mathematica. Tried here but no success.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.