0
$\begingroup$

Say I have two functions:

f[a_,b_]:=a + b g[c_,d_,e_]:=c + d - e 

And I define a third function:

h[u_,v_,w_,x_]:=f[u,v]+g[w,x,u] 

It's clear (to me, a human, at least) that h doesn't depend on u, but Mathematica still requires this extra argument to define h without trickery. This is a simple situation where I could replace the occurrences of u with something non-divergent, like 1. But for more complicated cases, such a choice could lead to unwanted (and essentially artificial) divergences. Is there a Correct Way (TM) to do this kind of functional definition, or is the general case really impossible for a CAS like Mathematica?

  • 0
    Thanks for the Accept. I see you did not upvote my answer however. If it is lacking, please tell me why, and consider un-Accpting it, since then the question is not resolved. Otherwise, please vote for it.2011-11-22

1 Answers 1

1

You could define your function using Set rather than SetDelayed and use Simplify or FullSimplify to cancel what Mathematica automatically can. I use Module to avoid collisions with global symbols.

f[a_, b_] := a + b g[c_, d_, e_] := c + d - e  Module[{u, v, w, x},   h[v_, w_, x_] = f[u, v] + g[w, x, u] // Simplify ] 

Now the definition of h reads:

h[v$_, w$_, x$_] = v$ + w$ + x$