0

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.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Katie
  • 63
  • 4
  • 4
    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? – Bob Hanlon Apr 18 '19 at 23:40
  • f is (Sin^n)[x_]/((Cos^n)[x_] + (Sin^n)[x_]) – Katie Apr 18 '19 at 23:49
  • 3
    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. – Bob Hanlon Apr 19 '19 at 00:00
  • 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? – xzczd Apr 19 '19 at 06:15
  • Possible duplicate: https://mathematica.stackexchange.com/questions/59820/is-there-a-way-to-rewrite-integrals-in-mathematica-using-u-substitution – Michael E2 Apr 19 '19 at 10:39
  • If you're using the substitute function defined in my answer, then a proper syntax is substitute[Integrate[f[x], {x, 0, Pi/2}], u -> pi/2 - x]. – Michael E2 Apr 19 '19 at 10:45

1 Answers1

1

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

nufaie
  • 1,081
  • 6
  • 14
  • 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. – Michael E2 Apr 21 '19 at 15:36