Umang Varshney

15 Reputation

One Badge

4 years, 145 days

MaplePrimes Activity


These are questions asked by Umang Varshney

Hi,

I was trying to differentiate an equation with two random variables with respect to my decision variable. But it took 4-5 hrs still MAPLE could not evaluate nor show an error.

 Later I want to find q* from the FOC and wish to substitute it back into the equation. I will be grateful if someone please help me in doing both.

doubt_1.mw

Thanks in Advance

Hi, 
I want to solve a simple newsvendor problem for general Demand Probability Distribution with maple code.
let, 
Underage cost 
                              c[u]

Overage cost 
                              c[o]

Demand (
D;
) follows pdf 
f(.);
 and CDF 
F;

(.);


Decision varible is quantity 
q;


So cost function is 

TC := piecewise(q-D >= 0, c[o]*(q-D), q-D < 0, c[u]*(-q+D));
 piecewise(0 <= q - D, c[o] (q - D), q - D < 0, c[u] (-q + D))

After taking expectation of TC and derivating it w.r.t q we will get 
q;
* as critical fractile i.e.

q*= F^(-1) (
                             c[u]    
                          -----------
                          c[u] + c[o]
)      i.e. F inverse (
c[u]/(c[u]+c[o]);
)

Can someone please help me how to find q* in MAPLE using solve() or any other function?

 

Thanks in Advance!

Hi,

I have a random variable that follows Uniform(1,4). Now I have a function which is of the following type:

g := a*alpha+b*t/alpha+exp(alpha)

where,

A := RandomVariable(Uniform(c, d));
                 RandomVariable(Uniform(c, d))
f := proc (alpha) options operator, arrow; PDF(A, alpha) end proc;
alpha -> PDF(A, alpha)
#Defining expectation fuction
E := proc (alpha) options operator, arrow; int(alpha*f(alpha), alpha = c .. d) end proc;
alpha -> int(alpha f(alpha), alpha = c .. d)
#g is a function of random variable &alpha;, where a and b are parameter

 

now I want to find the expectation of g and the first derivative of expectation of g,

E(g)

diff(E(g), t)

 

I understand the way I have defined E(alpha) is improper. But please understand my intent and help! here is the maple file also doubt_1.mw

Hi,

I am writing the following code and MAPLE is giving me operator error. Please help (file: doubt_6.mw)

d2:=100000000

for m in set_m do
    for n in set_n do
        SOL1 := fsolve({ODE11, ODE12}, {N, t__2});
        N1:=eval(N,SOL1);
        t_2_1 :=eval(t__2,SOL1);
        T_1:= eval(T, [lambda = 3, a = 300, b = .15, c = .25, A__m = 300, A__d = 150, A__r = 50,C__m = 4, P__m = 8, P__d = 10, 
        P__r = 12, theta__m = .15, theta__d = .12, theta__r = 0.5e-1, h__m = .2, h__d = .3, h__r = .5, i__m = .1, i__d = .1, 
        i__r = .1, i__om = .1, i__OD = .15, i__c = .3, i__e = .2, M = 2, alpha = 0.2e-1, t__2 = t_2_1]):
        t_31:= T_1 /m ;
        t_41:= T_1 /(m*n) ;
        if (N1<=t_41 and 2>=t_31) then
            d1:= eval(TCS__1, [lambda = 3, a = 300, b = .15, c = .25, A__m = 300, A__d = 150, A__r = 50, C__m = 4, P__m = 8, 
            P__d = 10, P__r = 12, theta__m = .15, theta__d = .12, theta__r = 0.5e-1, h__m = .2, h__d = .3, h__r = .5, i__m = .1, 
            i__d = .1, i__r = .1, i__om = .1, i__OD = .15, i__c = .3, i__e = .2, M = 2, alpha = 0.2e-1, t__2=t_2_1, N=N1]):
            if (d1<= d2) then
                d2:= d1;
                print("Value is updated",d2,N1,t_2_1,"for",m,n)
            end if
        end if    
        print(N1,t_2_1,t_31,t_41,d1,m,n)
    end do
end do

 

Thanks in advance

doubt5.mw

Hi I want to run the following algorithm in code edit region:

for m in set_m do
    for n in set_n do
      solve for N solving ODE11 and ODE12 simultaneously
      solve for t_2 solving ODE11 and ODE12 simultaneouly
      find t__3 and t__4
      if (N<=t_4 and M>=t_3) then
        d1= TCS__1 using n,m,t__2 and N
          if (d1< d2)
            d2=d1
            print(d2,m,n,N,t_2)
    end do
end do
 

But I am struck for to how to extract N and t__2 from SOL1 in code edit region

SOL1 := fsolve({ODE11, ODE12}, {N, t__2});

Thanks in advance

1 2 Page 1 of 2