mmcdara

3728 Reputation

17 Badges

6 years, 26 days

MaplePrimes Activity


These are replies submitted by mmcdara

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", "?"]))

@Anthrazit 

Ok, could have been a reason.
Good luck

Why not just import the whole file?
I could understand that if your file had a large number of columns and you were only interested in 3 of them. But in your case importing the whole 4 columns file is not more expensive that importing only 3 of them.

Let's assume M is the matrix whivh represents the content of your file and that the columns of interest have numbers i, j and k.
If you want to plot column j versus column i just do 

plot( M[.., [i, j]] )


or, if you want just a specific range m..n :

plot( M[m..n, [i, j]] )

@mehdibgh 

What postprocessing are you talking about?

  • if the read command takes too long, instead of save+read you can try 
    FileTools[Binary][WriteFile] + FileTools[Binary][Read]
    I use to use this for large matrices 106 by 100 (floats, typically 800 Mo), Read is done in less than 4 minutes.

PS; There is no document here  https://usaupload.com/5XgZ/f.txt 

@amrramadaneg 

What does this mean???

@rlopez 

Thank you. I wasn't aware of this command.

Two ways:

  1. see plots:-arrow
  2. or plottools:-arrow (I prefer this one)

this is sent from my phone and I can't check my reply: are you sure the last format is keres and not keras ?

@acer 

Thanks for your background.
I probably make poor use of Grid but I am saved by my PC having enough Gbytes not to be really bothered.

@acer 

Thank you acer for this detailed reply.
When I Grid:-Run my code I always face a balance issue between computation time and memory used.
Increasing the number of nodes to use decreases the former at the detriment of the latter. 
Is this the consequence of your sentence "The Grid package uses distinct instances of the Maple kernel (engine) for each node, with no cross-pollution of memory or assignments"?

@acer 

Hi,

I usually distribute mutually independent computations on the multiple nodes of my machine (which is not, IMO, the same thing to say that I "parallelize these computations", preferring to reserve that term to refer to parallel algorithms, but that's a point of view).
Anyway, here's the problem: I always do this using Grid. 
What precisely is the difference between Grid and Thread for this type of problem, of which the OP provides a good example?

A priori, there is no problem if you do things correctly (load your code with the big green arrow for us to see what you have really done).

BTW: the way you define A doesn't give a 2 by 2 matrix but a a 1 by 2 matrix

restart

kernelopts(version);

`Maple 2015.2, APPLE UNIVERSAL OSX, Dec 20 2015, Build ID 1097895`

(1)

A:=Matrix([[x,x^2],[2*x,sin(x)]]);

A := Matrix(2, 2, {(1, 1) = x, (1, 2) = x^2, (2, 1) = 2*x, (2, 2) = sin(x)})

(2)

kernelopts(multithreaded);
kernelopts(numcpus);
Threads[Map](int, A, x=0..2, numeric=true);

true

 

4

 

Matrix(2, 2, {(1, 1) = 2., (1, 2) = 2.666666667, (2, 1) = 4., (2, 2) = 1.416146837})

(3)

Grid:-NumNodes();
Grid[Map](int, A, x=0..2, numeric=true);

4

 

Matrix(2, 2, {(1, 1) = 2., (1, 2) = 2.666666667, (2, 1) = 4., (2, 2) = 1.416146837})

(4)

  

Download Map_Int_A.mw

@tomleslie 

Provided the equations are linearly independent :-)
Which is the case here

1 2 3 4 5 6 7 Last Page 2 of 86