TransWikia.com

Integrating piecewise function on an range

Mathematica Asked on February 27, 2021

P1 = Integrate[(Abs[[Psi]s1])^2, {x, 0,b}]

When I integrate the above function, I am getting an answer as below. I am not sure what’s going on.
1/3 a A Conjugate[A]

Psi]s1 is same as the following piecewise function. ie, [Psi]s1= [Psi][x, 0]
I am expecting,

d

Then only further calculations can be performed.

s

Also while integrating the modulus square of the above piece wise functions , it is showing an error.

 [Psi][x_, 0] := 
     Piecewise[{{(A*x)/a, 0 <= x <= a}, {A*(b - x)/(b - a), a <= x <= b}}]
Integrate[(Abs[[Psi][x, 0]])^2, {x, a, b}]

The original answer is:

ss
s

One Answer

Clear["Global`*"]

Include the assumption 0 < a < b

ψ[x_, 0] := 
 Piecewise[{{(A*x)/a, 0 <= x <= a}, {A*(b - x)/(b - a), a <= x <= b}}]

Assuming[0 < a < b, 
 Integrate[(Abs[ψ[x, 0]])^2, {x, 0, b}] // Simplify]

(* 1/3 b Abs[A]^2 *)

Assuming[0 < a < b, 
 Integrate[(Abs[(A*x)/a])^2, {x, 0, a}] + 
   Integrate[(Abs[A*(b - x)/(b - a)])^2, {x, a, b}] // Simplify]

(* 1/3 b Abs[A]^2 *)

Assuming[0 < a < b, 
 Integrate[(Abs[ψ[x, 0]])^2, {x, 0, a}] + 
   Integrate[(Abs[ψ[x, 0]])^2, {x, a, b}] // Simplify]

(* 1/3 b Abs[A]^2 *)

Correct answer by Bob Hanlon on February 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP