I have to do a substitution (u = pi/2-x) into an definite integral, which I have defined as f[u]. When I evaluate my code, no result is produced.

The code I have written is

substitute[Integrate[f[u], x], {x, 0, Pi/2}], u -> pi/2-x]

Is there something I am missing in my code that I am unaware of?

My f[u]is ((Sin[x])^n/(Cos[x])^n + (Sin[x])^n). and I am trying to substitute u = u = pi/2-x into` it.

  • 4
    $\begingroup$ There is no Mathematica command substitute (look at documentation for ReplaceAll). pi should be Pi (all built-in symbols start with a capital letter). Pattern Blank(_) is only used on LHS of function definition not when using the function. What is the definition of your function f? $\endgroup$ – Bob Hanlon Apr 18 '19 at 23:40
  • $\begingroup$ f is (Sin^n)[x_]/((Cos^n)[x_] + (Sin^n)[x_]) $\endgroup$ – Katie Apr 18 '19 at 23:49
  • 3
    $\begingroup$ On a previous question you were told that Sin^n and Cos^n are the wrong syntax and shown the proper syntax. Edit your question to include the definition of f using the proper syntax. Also edit to make best effort to correct other issue that have been pointed out. $\endgroup$ – Bob Hanlon Apr 19 '19 at 0:00
  • $\begingroup$ It's not the first time I see someone trying to use the nonexistent function substitute. (Someone even posts answer using substitute! ) What textbook are you guys refering to? $\endgroup$ – xzczd Apr 19 '19 at 6:15
  • $\begingroup$ Possible duplicate: mathematica.stackexchange.com/questions/59820/… $\endgroup$ – Michael E2 Apr 19 '19 at 10:39

You have to solve for x with respect to u then name it y then substitute with it because your original function f[x] depend on x there's only x

f[x_] := ((Sin[x])^(n)/(Cos[x])^(n)) + (Sin[x]^n)

y = x /. Solve[u == (pi/2) - x, x] /. Rule -> Equal

final = Integrate[f[x], x, {x, 0, Pi/2}] /. x -> y

enter image description here

  • $\begingroup$ I guess the OP doesn't care that your answer still contains a u, even though the only parameters in the original problem are pi and n (although pi might be a typo for Pi). Note that your integrate code is equivalent to $\int \int _0^{\frac{\pi }{2}}f(x) \, dx \, dx$. I doubt that's the right way to interpret the OP's syntax error. $\endgroup$ – Michael E2 Apr 21 '19 at 15:36

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