Re: How to solve the integrate problem
- To: mathgroup at smc.vnet.net
 - Subject: [mg128143] Re: How to solve the integrate problem
 - From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
 - Date: Wed, 19 Sep 2012 04:54:38 -0400 (EDT)
 - Delivered-to: l-mathgroup@mail-archive0.wolfram.com
 - Delivered-to: l-mathgroup@wolfram.com
 - Delivered-to: mathgroup-newout@smc.vnet.net
 - Delivered-to: mathgroup-newsend@smc.vnet.net
 - References: <5F5696D639DA7D4C842D85A250023D8710D417C8@DB3PRD0710MB393.eurprd07.prod.outlook.com>
 
But that is exactly what I have written you. The answer is given by the function
Integrate[f[x], {x, 0, xmax}, Assumptions -> Q >= 0]
Take care: Mathematica is case-sensitive. According to what you have written in this message, all you parameters are positive, are they? If yes, you may include all of them into assumptions like the following:
Integrate[f[x], {x, 0, xmax}, Assumptions -> {Q >= 0. P>0,v>0, g>0,B>0}]
If you have some other relations (like inequalities) between parameters, include them also. This might help.
However, since you have a piecewise function, f,  the answer is also a piecewise function of the upper integration boundary,
xmax. The construct
Manipulate[
 Integrate[f[x], {x, 0, xmax}, Assumptions -> Q >= 0],
{xmax, 0, 2}]
allows you to dynamically check what happens when you vary xmax. For this you need first to fix numerical values of all parameters except x and xmax.
Check Menu/Help/Integrate and Menu/Help/Manipulate.
Have fun, Alexei
Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG
Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44
e-mail: alexei.boulbitch at iee.lu<mailto:alexei.boulbitch at iee.lu>
From: =1B$BD%EP6,=1B(B [mailto:toc531 at gmail.com]
Sent: Tuesday, September 18, 2012 5:56 AM
To: Alexei Boulbitch
Subject: [mg128143] Re: How to solve the integrate problem
Thank you. I think I didn't make my question clear. I explain my question again.
Each unit purchased costs "v",each unit sold produces a revenue of "p",each unit disposed as salvage gives a revenue of "g",and there is an additional cost"B" associated with each unit of demand not satisfied. If a quantity "Q" a demand "x" occurs, the profit is
P(Q,x)=-Qv+px+g(Q-x)  if x<=Q
       -Qv+pQ-B(x-Q)  if x>=Q
The expected value of the profit, as a function of Q, is given by
E[P(Q)]=integrate[{P(Q,x)},{x,0,infinite}]
Question:I don't know how to use mathematica to solve E[P(Q)]
Thank you.
2012/9/17 Alexei Boulbitch <Alexei.Boulbitch at iee.lu<mailto:Alexei.Boulbitch at iee.lu>>
x>Q ,Q(P-W)-M(x-Q),  x belongs(Q,infinite)
x<=Q,P*x-W*Q+S(Q-x), x belongs(0,Q)
Q,P,W,M,S are unknown constant number.
I want to *dx*
THANK U
It is not very clear, what do you mean by "I want to *dx*". If you need
to integrate your expression, try this:
(* This is your function *)
f[x_] := If[x > Q, Q (P - W) - M (x - Q), P*x - W*Q + S (Q - x)]
(* Here it is drawn with arbitrarily selected values of its parameters to see, how it looks like *)
Plot[f[x] /. {Q -> 1, P -> 2, W -> 1, M -> 1.5, S -> 3}, {x, 0, 3}]
(* Here the integral is calculated. It is a piecewise function and its value depends upon the value of Q *)
(* as well as upon the value xmax *)
Manipulate[
 Integrate[f[x], {x, 0, xmax}, Assumptions -> Q >= 0], {xmax, 0, 2}]
If you want to calculate the derivative, consider this:
D[f[x], x]
If[x > Q, -M, P - S]
Have fun, Alexei
Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG
Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44
e-mail: alexei.boulbitch at iee.lu<mailto:alexei.boulbitch at iee.lu>