mmcdara

4019 Reputation

17 Badges

6 years, 177 days

MaplePrimes Activity


These are replies submitted by mmcdara

@Shameera 

(please look to my last question and @acer's answer)

Here is, after a lot of corrections, the solution of your last problem

Download problem_1_mmcdara.mw

@Zeineb 

T = { {}, Z} is a sigma-algebra
T = P(Z) where P(Z) is the set of parts of Z (the output of combinat:-powerset) ia another sigma-algebra
T = { {}, {1}, {0, 2, 3}, Z } is still another sigma-algebra.

What do you want ?

@acer 
Hi, is there a difference in using

Typesetting:-Suppress(f(x));

instead of

alias(f=f(x));

?

@Kitonum 

The integration along x should be -3..1

@tomleslie 

Thanks Tom, I hadn't had time to check your solution.
I just sent you and Acer a reply that seems to answer my problem.

Thanks again

@acer @tomleslie

Having look to the procedure RandomVariable, I've seen that instead of 

A := RandomVariable(Uniform(0, 1));
          _R

it is possible to write 

RandomVariable(A, Uniform(0, 1));
          A

(which is an undocumented feature).

Thus I think that the better way (IMO) to fix my problem is to do this

restart
with(Statistics):
RandomVariable(A, Uniform(0, 1));
RandomVariable(B, Uniform(0, 2));
RandomVariable(C, Uniform(1, 2));
                               A
                               B
                               C
F := (A+2*B)/C
                            A + 2 B
                            -------
                               C   

 

@acer 

"which may not be true...." : I agree, it was implicit to me that I would not write something like P:=A :

"I am not a fan of this kind of thing,..." : Too bad, it seemed to me a good alternative to tomleslie's answer.

Concerning your last proposal, what annoys me is that the introduction of new names (a, b, c) can make the evaluation "unsafe" in the sense that we could write inadvertently [A=a, B=b, C=b].
I had the feeling that tomleslie's proposal was a good solution: what is your opinion about it? Has his method any drawbacks?

What is the format of all these dates?

@tomleslie 

Very good idea Tom.

What do you expect for the number 123000321 ???

@Carl Love 

A very astute way.

Nevertheless, here is a problem with the question the OP asked, please look at this

x := 123000321;
ListTools:-Reverse(convert(x, base, 1000))
                           123000321
                         [123, 0, 321]

I suppose the OP would like to get  [123, 000, 321] instead, which in some sense is stupid.

@dharr 

Bravo!
I vote up.

BTW, expressing your solution in terms of hypergeometric functions and comparing the result to the one got by the OP could mabe (or not) help understanding why your change of variable leads to a solution?

Can't you provide anything else than this useless pdf file?
A text file for instance?

@BekkiRR 

Hi, S_TEV-S_P doesn't depend on h: do this to convince yourself

indets(S_TEV-S_P, name)

Thus the "sensitivity" of the indifference curve to h is eveywhere null.

Nevertheless there is an example of the first step for a sensitivity analysis (one can't go further for the the reason above):
SA_1.mw

@BekkiRR 

Is it this what you want?
The desired data frame is the 52 by 3 matrix named Zero_Curve_3D

restart

E := 'E':

h := 4:                     

m := 0.035:

g:= h*m:            

k := 0.15:

a := 0.25:

F_ANR := 4*m:

r:= 0.1:

T := 'T':

ESt := piecewise

(E < 9984, 0,E < 14926, (1008.7*(E - 9984)/10000 + 1400)*(E - 9984)/10000,E < 58596, (206.43*(E - 14926)/10000 + 2397)*(E - 14926)/10000 + 938.24,E < 277826, 0.42*E - 9267.53,0.45*E - 17602.28):

Er := E + (E - ESt)*r:

EStr := piecewise(Er < 9984, 0,Er < 14926, (1008.7*(Er - 9984)/10000 + 1400)*(Er - 9984)/10000,Er < 58596, (206.43*(Er - 14926)/10000 + 2397)*(Er - 14926)/10000 + 938.24,Er < 277826, 0.42*Er - 9267.53,0.45*Er - 17602.28):

srp := EStr/E:

r_p := r*srp:

S_P := ESt*(1 + r_p)^T:

EStk := piecewise(K < 9984, 0,

K < 14926, (1008.7*(K - 9984)/10000 + 1400)*(K - 9984)/10000,

K < 58596, (206.43*(K - 14926)/10000 + 2397)*(K - 14926)/10000 + 938.24,

K < 277826, 0.42*K - 9267.53,0.45*K - 17602.28):

r_tev := 0.29*r:

K := (0.71*E*(1 + 0.71*r)^T)*0.6:

stev := EStk/K:

S_TEV := E*(0.29*(1 + r_tev)^T + 0.71*(0.6*stev)):

# The next line comes from Preben's answer

p := plots:-implicitplot(S_TEV-S_P=0, E = 0 .. 500000, T = 0 .. 15):

# get the (E, T) points corresponding to the curve S_TEV-S_P=0
ET_points     := plottools:-getdata(p)[-1]:

# add the values of S_TEV in a 3rd column
f             := unapply(S_TEV, (E, T)):
Zero_Curve_3D := < ET_points | Vector(numelems(ET_points[..,1]), i -> f(entries(ET_points[i], nolist))) >:

# plot
PLOT3D(CURVES(Zero_Curve_3D), THICKNESS(4), COLOR(RGB, 1, 0, 0), LABELS(["E", "T", "?"]))

 

 

Download SA.mw

An alternative way is to use  intersectionplot :

p := plots:-intersectplot(S_TEV, S_P, E=1..500000, T=0..15):
plots:-display(p);

The "data frame" XYZ you are looking for can now be obtained this way

data := plottools:-getdata(p):
XYZ  := `<,>`(seq(i[-1], i in data));
PLOT3D(CURVES(XYZ), THICKNESS(4), COLOR(RGB, 1, 0, 0), LABELS(["E", "T", "?"]))
4 5 6 7 8 9 10 Last Page 6 of 91