MaPal93

170 Reputation

5 Badges

2 years, 98 days

MaplePrimes Activity


These are questions asked by MaPal93

Hi,

I have a data structure/plotting question. How do I plot the 3 lambdas (singleaxis) and the 6 betas (dualaxis) for 12 calibrations (1000 runs each)? All the details are in the script 230523_different-calibrations.mw. Thank you!

For the beta plots and subplots, please follow the dualaxis example output format at the bottom of my script for each of the 12 calibrations.

For the lambda plots, I'd like to combine a few of them as follows (each plot with lambda_1 subplot, lambda_2 subplot, and lambda_3 subplot - note that the lambda plot example at the bottom of the script is dualaxis but I just need singleaxis):

PLOT 1 (singleaxis): lambda_1, _2, _3 for ncal2 and ncal3 (superimposed, 2 data series for each subplot)

PLOT 2 (singleaxis):  lambda_1, _2, _3 for ncal7 and ncal8 (superimposed, 2 data series for each subplot)

PLOT 3 (singleaxis):  lambda_1, _2, _3 for ncal4, ncal5, ncal6 (superimposed, 3 data series for each subplot)

PLOT 4 (singleaxis):  lambda_1, _2, _3 for ncal9, ncal10, ncal11 (superimposed, 3 data series for each subplot)

I have access to a powerful GPU, a NVIDIA Tesla A100.

How to leverage it to solve my system of 3 nonlinear equations in 3 variables? Script: 160523_stylized_problem_GPU.mw

I don't think that it is just by adding the following two lines right before my solve() block, right?
CUDA:-Enable(true)
CUDA:-IsEnabled()

(https://www.maplesoft.com/products/maple/features/cuda.aspx)

I also read https://mcsr.olemiss.edu/docs/gpus-on-maple/ and https://www.mapleprimes.com/posts/36412-GPU-Programming-CUDA-OpenCL-And-Maple but it's still not clear to me. Thanks!

120523_problem_parallel.mw

Last execution block is not producing any output. Why?

The 3x3 nonlinear system I am trying to solve is already a stylized version of my problem, as I already:

  1. Calibrated my equations before attempting to solve for them (search for "Calib_1" in my script)
  2. Split the original 6x6 system into two 3x3 sub-systems (since 3 out of 6 variables only appear in 3 out of 6 equations) and solved for one sub-system

What else can you think of? Should I instead use the parallel solver on the whole 6x6 system rather than just the unsolved 3x3 sub-system?

How to find, if exist, singular solutions? That is, some valuation of some parameters that will yield a solution that cannot be obtained by applying the same valuation to a general solution. Carl Love (who I cannot tag) once mentioned: "The parameter valuations that lead to singular solutions can often be guessed by using valuations that would produce zeros in denominators in the general solution. A singular solution can't be expressed as any instantiation of a generic symbolic solution. By instantiation I mean an assigment of numeric values to some parameters. Here's an example:"

#2x2 matrix and 2x1 vector. 5 parameters (a, b, d, x, y). The 2 decision variables are
#unseen and unnamed in this pure matrix-vector form. Their values are the two entries 
#in the solution vectors S0 and S1.

A:= <a, b; 0, d>;  B:= <x, y>;

#Get a generic solution:
S0:= LinearAlgebra:-LinearSolve(A, B);

#Instantiate 3 parameters (a, d, y) to 0 and solve again:
S1:= LinearAlgebra:-LinearSolve(eval([A, B], [a, d, y]=~ 0)[]);

#Note that no possible instantiation of S0 can produce S1.

Thank you!

I think some form of simplify() would do but I am not sure how.

See the following script for more details:

restart

#Define the assumptions ex-ante (variances as real and positive, correlations in between -1 and +1 and so on...) - or Maple wouldn't know

assume(`#msub(mi("mu",fontstyle = "normal"),mi("1"))`::real, `#msub(mi("mu",fontstyle = "normal"),mi("2"))`::real, `#msub(mi("mu",fontstyle = "normal"),mi("3"))`::real, `#msub(mi("lambda",fontstyle = "normal"),mi("1"))`::real, `#msub(mi("lambda",fontstyle = "normal"),mi("2"))`::real, `#msub(mi("lambda",fontstyle = "normal"),mi("3"))`::real, `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon1"))`::real, `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon2"))`::real, (`#msub(mi("nu",fontstyle = "normal"),mi("0"))`[1])::real, (`#msub(mi("nu",fontstyle = "normal"),mi("0"))`[2])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 2])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 3])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("u"))`[2, 3])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("v"))`[1, 2])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[1])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[2])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[3])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[1])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[2])::real)
 

assume(0 <= `#msub(mi("mu",fontstyle = "normal"),mi("1"))`, 0 <= `#msub(mi("mu",fontstyle = "normal"),mi("2"))`, 0 <= `#msub(mi("mu",fontstyle = "normal"),mi("3"))`, 0 <= `#msub(mi("lambda",fontstyle = "normal"),mi("1"))`, 0 <= `#msub(mi("lambda",fontstyle = "normal"),mi("2"))`, 0 <= `#msub(mi("lambda",fontstyle = "normal"),mi("3"))`, 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon1"))`, 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon2"))`, 0 <= `#msub(mi("nu",fontstyle = "normal"),mi("0"))`[1], 0 <= `#msub(mi("nu",fontstyle = "normal"),mi("0"))`[2], -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 2] and `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 2] <= 1, -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 3] and `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 3] <= 1, -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[2, 3] and `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[2, 3] <= 1, -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("v"))`[1, 2] and `#msub(mi("rho",fontstyle = "normal"),mi("v"))`[1, 2] <= 1, 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[1], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[2], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[3], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[1], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[2])

NULL

t__1 := (`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

t__2 := -`&sigma;__v`[1]*`&rho;__v`[1, 2]*`&sigma;__v`[2]*`&sigma;__&epsilon;1`^2/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

t__3 := (`&sigma;__v`[1]*`&rho;__v`[1, 2]*`&sigma;__v`[2]*`&sigma;__&epsilon;1`^2*`&nu;__0`[2]-`&nu;__0`[1]*`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))


See for example that they share the same denominator...
# I want Maple to automatically/smartly choose the most compact way...e.g., (i) t2=t1+... or (ii) t2=t3*... (i) is equivalent to (ii) but I want Maple to pick (ii) if more compact than (i)
# I have 9 expressions like t1,t2,t3 and I want Maple to re-write them as function of each other smartly

 

NULL

``

Download rearrangingterms.mw

It must be something similar to this https://www.mapleprimes.com/maplesoftblog/201455-Rearranging-The-expression-Of-Equations, but my case is slighty different.

Please check: Finding_Chi_Version1.mw

My end goal is to find the following three expressions:

chi_1 := collect(X_A,[nnu[1],nnu[2]]);

chi_2 := collect(X_B,[nnu[1],nnu[2]]);

chi_3 := collect(X_C,[nnu[1],nnu[2]]);

I expect these three expressions to be linear combinations of random variables nu[1] (nnu[1]) and nu[2] (nnu[2]).

While calling solve(), I encounter this error:

Error, (in assuming) when calling 'SolveTools:-Engine:-Dispatch'. Received: 'badly formed input to solve: not fully algebraic'

What is exactly the issue here? If it can help you answer my doubt, that argmin expression I defined is composed by conditional means and variances which I computed as in here: conditional_distributions_Version1.mw

The two formulas I am trying to implement in Maple are conditional distribution of a multivariate normal distributionAm I already doing any mistake in conditional_distributions_Version1.mw? An alternative interpretation of mine for these two formulas is: conditional_distributions_Version2.mw. Please check the light-blue-highlighted differences in the conditional variance calculation. This alternative interpretation leads to Finding_Chi_Version2.mw, which I also can't solve() (solver stuck in "evaluating") but at least I don't get the error mentioned above...

I am a bit lost to be honest: Is Finding_Chi_Version1 or Finding_Chi_Version2 the correct interpretation? 

Thanks!

5 6 7 8 9 Page 7 of 9