# Question:Why doesn´t Maple do trivial substitutions?

## Question:Why doesn´t Maple do trivial substitutions?

Maple 14

I discovered, that Maple did substitute every single parameter but c!

Anyway, when I isolate the problem and do not assume anything for mu and sigma, the problem does not occur.

Therefore I print here the complete relevant code.

Is there a way to "convince" Maple to do those trivial substitutions of c also, without seperating each problematical expression?

Here is the code:

restart;
with(Statistics):

#Definitions and assumptions
#Definition of continuous distributions
Y1 := RandomVariable(Beta(nu, omega)):
Y2 := RandomVariable(ChiSquare(nu)):
Y3 := RandomVariable(Error(a, b, c)):
Y4 := RandomVariable(Exponential(b)):
Y5 := RandomVariable(Gamma(b, c)):
Y6 := RandomVariable(Gumbel(a, b)):
Y7 := RandomVariable(InverseGaussian(zeta, lambda)):
Y8 := RandomVariable(Laplace(a, b)):
Y9 := RandomVariable(LogNormal(b, c)):
Y10 := RandomVariable(Maxwell(b)):
Y11 := RandomVariable(Moyal(a, b)):
Y12 := RandomVariable(Normal(mu, sigma)):
Y13 := RandomVariable(Pareto(b, c)):
Y14 := RandomVariable(Power(b, c)):
Y15 := RandomVariable(Rayleigh(b)):
Y16 := RandomVariable(StudentT(nu)):
Y17 := RandomVariable(Weibull(b, c)):
Y18 := RandomVariable(Logistic(a, b)):
Y19 := RandomVariable(Triangular(p, q, r)):

#Definition of uility functions
APM:=proc(Utility) # This procedure calculates the Arrow-Pratt measure
APM[Utility]:=-(diff(diff(Utility,t),t))/diff(Utility,t);
end proc;
CRRA := t->((t)^(1-rho))/(1-rho);
simplify(APM(CRRA(t)));

interface(showassumed=0):
assume(t::real):
assume(0 < phi):
assume(0 < rho, rho <> 1):
assume(0 < epsilon):
assume(0 <= kappa, kappa <> 1):
assume(0 < xi):
assume(0 < (beta)/(delta), (beta)/(delta) < 1, 0 < (alpha+delta*t)): #---------------------------------------------------------------------------------------------
assume(0 < nu, 0 < omega):
assume(a::real, 0 < b, 0 < c):
assume(0 < zeta, 0 < lambda):
assume(mu::real, 0 < sigma):
assume(p < r, r < q, p::real, q::real, r::real):

#Quantification of certainty equivalence
#CRRA
for i from 1 to 19 do
ExpectedValue(CRRA((Y||i))):
g||i := simplify(%)=CRRA(s):
kCRRA||i := solve(g||i, s, UseAssumptions):
end do:

for i from 1 to 19 do
if i=3 then next end if:
i = simplify(kCRRA||i);
end do;

#Substitution for mu and sigma
#Solve expected value and variance for the parameters of the distributions
g1:=solve({mu = Mean(Y1), sigma^2 = Variance(Y1)},{nu,omega});
g2:=solve({mu=Mean(Y2)},{nu});
assume(GAMMA((1/2)*c) > 0, 0 < sqrt(2^c*GAMMA((3/2)*c)*GAMMA((1/2)*c))*sigma/(2^c*GAMMA((3/2)*c))):
g3:=solve({mu = Mean(Y3), sigma^2 = Variance(Y3)},{a,b}, UseAssumptions);
g4:=solve({mu=Mean(Y4)},{b});
g5:=solve({mu = Mean(Y5), sigma^2 = Variance(Y5)},{c,b});
assume(0 < sigma):
g6:=solve({mu = Mean(Y6), sigma^2 = Variance(Y6)},{a,b}, UseAssumptions);
g7:=solve({mu = Mean(Y7), sigma^2 = Variance(Y7)},{zeta,lambda});
g8:=solve({mu = Mean(Y8), sigma^2 = Variance(Y8)},{a,b}, UseAssumptions);
g9:=solve({mu = Mean(Y9), sigma^2 = Variance(Y9)},{b,c}, Explicit)[1];
g10:=solve({mu=Mean(Y10)},{b});
g11:=solve({mu = Mean(Y11), sigma^2 = Variance(Y11)},{a,b}, UseAssumptions);
g12:=solve({mu = Mean(Y12), sigma^2 = Variance(Y12)},{mu,sigma});
assume(c>2,mu>0):
g13:=solve({mu=Mean(Y13),sigma^2 = Variance(Y13)},{b,c}, UseAssumptions);
assume(c>0,mu>0):
g14:=solve({mu=Mean(Y14),sigma^2 = Variance(Y14)},{b,c}, UseAssumptions);
g15:=solve({mu=Mean(Y15)},{b});
assume(nu>2,sigma>1):
g16:=solve({sigma^2=Variance(Y16)},{nu}, UseAssumptions);
g17:=solve({mu = Mean(Y17), sigma^2 = Variance(Y17)},{b,c}, UseAssumptions);
g18:=solve({mu = Mean(Y18), sigma^2 = Variance(Y18)},{a,b}, UseAssumptions);
g19:=solve({mu = Mean(Y19), sigma^2 = Variance(Y19)},{p,q}, Explicit)[1];

#Insertion into the certainty equivalences to obtain a preference function conditional on mu and sigma:
mu:='mu': sigma:='sigma':

#CRRA
for i to 19 do
if i=3 or i=17 or i=19 then next end if:
#gCRRA||i:=simplify(normal(eval(kCRRA||i,g||i))); # Try 1 -> but c sticks.
gCRRA||i:=simplify(subs(g||i,kCRRA||i)); # Try 2 -> but c sticks.
end do;

﻿