MaplePrimes Questions

Can anyone help me fix a corrupted maple file?

I have tried to fix it myself and searched all over for a solution but can' seem to fix it myself. Please help

Download Styrkelære2regneopgaver.mwStyrkelære2regneopgaver.mwStyrkelære2regneopgaver.mw

Stupid question, but how do I get the code on the math apps CaesarCipher from the help page?  I see the variable cipher but it's content is a mystery.

(Sorry guys, I changed the title to better reflect the content of the question and it bumped back up the top)

1) Say I have an Excel sheet with first column with my dependent variable values Y

2) Remaining columns to the left say some maximum 30 columns are independent variable

One thing is to import the excel columns to maple matrix

Then matrix will have first column dependent variable

Another's independent variables

3) Now i need to pick 2 independent variables columns and ( the dependent variable columns say Y which is the first column)

4) apply the normal regular MLR regression on it  then check if R^2 is good the p vaule are below 0.05

5) I print the column names of those columns

The first row will be the header column which has the variable name.

Kind help someone please kind help your help will be great greatly acknowledged 

Hello everyone,

Here is a stylized version of my problem. Given three normally distributed random variables {A, B, C}, I want to find the X_1, X_2, X_3 that maximize the following expression (gamma being a constant and A being a linear combination of other normally distributed random variables):

Max{ Exp[A|B,C] - (gamma/2)*Var[A|B,C] }

All the details are here: 070423_Optimization.mw

In particular, I am seeking your help to:

  1. Correlate three random variables (an example of the procedure for correlating two random variables is already provided in the script).
  2. Verify my understanding of the linear projection theorem (https://stats.stackexchange.com/questions/30588/deriving-the-conditional-distributions-of-a-multivariate-normal-distribution) in two dimensions, that is, to compute conditional means and variances of the form E[X|Y,Z] and V[X|Y,Z].
  3. Implement and adapt the linear projection theorem to my problem in Maple.
  4. Combine all together to obtain Expr = E[A|B,C] + V[A|B,C] and find the optimal {X_1, X_2, X_3} by solving the linear system of three equations in the three variables {X_1, X_2, X_3}, where the three equations are obtained by setting to 0 the partial derivatives of Expr with respect to {X_1, X_2, X_3}.

 

In relation to point 2., did I correctly interpret the matrix form of the three-dimensions version of the linear projection theorem?

 

In relation to point 3., I attach a stylized script for the three-dimensions version (note that I need the two-dimensions version for my problem): LinearProjectionTheorem_3dimensions.mw. Assuming a correct interpretation of the theorem:

  • Did I correctly implement E[X_2|Y_1,Y_2,Y_3] and E[X_3|Y_1,Y_2,Y_3] as in the picture above?
  • How to adapt it accordingly to include E[X_1|Y_1,Y_2,Y_3] and V[X_1|Y_1,Y_2,Y_3], V[X_2|Y_1,Y_2,Y_3], and V[X_3|Y_1,Y_2,Y_3]? 
  • How to apply it to the random variables in my script to eventually find the optimal {X_1,X_2,X_3}?

 

You can play around with my script 070423_Optimization.mw and send me the updated version. The problem I am trying to solve is quite convoluted, so let me know if you need any further clarification. Thanks a lot!

Actually, I have two questions here, I don't know if they are connected.

I don't know if it's the right way to deifne function with indexed variables, is there any difference between f and g?

I assume they are the same since neither of them work with Maximize.

Finally, I use the most original way in (5), why give the wrong answer? (no way the answer is -infinity)

restart

f := proc (x) options operator, arrow; sum(ln(x[i]), i = 1 .. 4) end proc

proc (x) options operator, arrow; sum(ln(x[i]), i = 1 .. 4) end proc``

(1)

g := proc (x) options operator, arrow; ln(x[1])+ln(x[2])+ln(x[3])+ln(x[4]) end proc

proc (x) options operator, arrow; ln(x[1])+ln(x[2])+ln(x[3])+ln(x[4]) end proc

(2)

f([1, 1, 1, 1])

0

(3)

cons := {x[1]+x[2] <= 1, x[1]+x[3] <= 2}

{x[1]+x[2] <= 1, x[1]+x[3] <= 2}

(4)

with(Optimization)

Maximize(f, cons, assume = nonnegative)

Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of  procedures

 

Maximize(f, {x[1]+x[2] <= 1, x[1]+x[3] <= 2}, assume = nonnegative)

Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of  procedures

 

Maximize(g, cons, assume = nonnegative)

Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of  procedures

 

Maximize(g, {x[1]+x[2] <= 1, x[1]+x[3] <= 2}, assume = nonnegative)

Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of  procedures

 

 

Maximize(sum(ln(x[i]), i = 1 .. 4), {x[1]+x[2] <= 1, x[1]+x[3] <= 2}, assume = nonnegative)

[Float(-infinity), [x[1] = HFloat(1.0), x[2] = HFloat(0.0), x[3] = HFloat(1.0), x[4] = HFloat(1.0)]]

(5)

NULL

Download mre.mw

In the last two months I've have been asked to download an update to 2022.1 around 7 times.

Each oupdates takes 5-10 minutes and I have to sit idle.

1. Is this the typical pace of updates?

2.Is there a veriosn 2023 I need to get? if yes, how?

Thanks!

i try to plot this equation        2.96736996560705*10^(-12)*p^2+1.31319840299485*10^(-13)*t^2-8.89549693662593*10^(-7)*p+8.53128393394231*10^(-7)*t-3.65558815509970*10^(-30)*p*t-1 = 0 and use this command plots:-implicitplot(TWeq, p = -10^10 .. 10^11, t = -3*10^8 .. 3*10^8, gridrefine = 3, scaling = constrained, size = [1000, 100]) but  it only shows like this

it should be an ellipse but it just show like this..please help me.

S1 := 441;
S2 := 1109;
S3 := 511;
S4 := 900;
S5 := 2904;
S6 := 285;

S2 + S3 + S4 + S5 + S6;                             
for i to 5 do
    S*[i] + S[i + 1];
end do;
Thank you.

The following results should be true or false, but unfortunately, both of them become FAIL (in Maple 2023): 

interface(version)

_EnvTry := hard:

`Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`

(1)

assume(`or`(n < 0, n >= 1), m > (1/2)*n*(n-1))

is(m < 0);

is(m > 0)

false

 

FAIL

(2)

coulditbe(m, 0)

FAIL

(3)

NULL


Download Unable_to_prove.mw

Does anyone know why?

Is there a simpler and more elegant way to get the last result in this code snippet?

add(f~([op(a+b)])[]);
                          f(a) + f(b)
# simpler and more elegant
map(f, a+b);
                          f(a) + f(b)
# now I want to obtain this result
add(f~([op(a+b)], t)[]);
                       f(a, t) + f(b, t) 

TIA

I receive the following error when I run maple to solve a diff equation.
Thank you in advance for your help.

eq1:=A__n=[X__n+[(C-z)*(tan(theta1)+tan(theta2))]] * [B + (2*(C-z)*tan(theta3))];
eq2:=P__n=[2*(X__n+B)] + 2 * (C-z) * [(tan(theta1)+tan(theta2)) + (2*tan(theta3))];
eq3:=gamma - [cu*(P__n/A__n)] = diff(sigma__v(z),z);
eq4:=subs([eq1,eq2],eq3);
ics:=sigma__v(0)=sigma__s;
sol:=simplify(dsolve(([eq4,ics]), sigma__v(z)));
NULL

A__n = [X__n+[(C-z)*(tan(theta1)+tan(theta2))]]*[B+2*(C-z)*tan(theta3)]

 

P__n = [2*X__n+2*B]+2*(C-z)*[tan(theta1)+tan(theta2)+2*tan(theta3)]

 

gamma+[-cu*P__n/A__n] = diff(sigma__v(z), z)

 

gamma+[-cu*([2*X__n+2*B]+2*(C-z)*[tan(theta1)+tan(theta2)+2*tan(theta3)])/([X__n+[(C-z)*(tan(theta1)+tan(theta2))]]*[B+2*(C-z)*tan(theta3)])] = diff(sigma__v(z), z)

 

sigma__v(0) = sigma__s

 

Error, (in PDEtools/NumerDenom) invalid input: `PDEtools/NumerDenom` expects its 1st argument, ee, to be of type algebraic, but received [tan(theta1)+tan(theta2)+2*tan(theta3)]

 

``

Download diffeq.mw

I've been trying for so long to fix my code I could've done the math by hand by now. All equations and variables seem to be recognized correctly. Can anyone point out where I made an error? Thanks

Chem.mw

restart; K1 := 10^(-2.12); K2 := 10^(-7.21); K3 := 10^(-12.32); Kw := 10^(-14); NaCl := .5004/(58.44); NaH2PO4 := .1092/(119.98); Na2HPO4 := 1.214/(141.96); Why := Kw = H*OH; Do := K1 = H*H2PO4/H3PO4; It := K2 = H*HPO4/H2PO4; Today := K3 = H*PO4/HPO4; When := Cl = NaCl; Its := Na = NaH2PO4+2*Na2HPO4+NaCl; Due := Na+H = Cl+3*PO4+2*HPO4+H2PO4+OH; Tomorrow := Na2HPO4+NaH2PO4 = H3PO4+H2PO4+HPO4+PO4; z := solve([Why, Do, It, Today, When, Its, Due, Tomorrow], [H, OH, Na, CL, PO4, HPO4, H2PO4, H3PO4]); assign(z)

[]

(1)

Download Chem.mw

What is the result of the following?

solve((4*t1+4*sqrt(t1^2-4*t2))>0,{t2});
 

This happened on Windows 10 clicking on *.mws documents while Maple 2023 was not running.

My observations with one document (I do not have others at hand at the moment):

No freeze when Maple is already running.

No freeze when the startup page (Start.mw) is disabled.

Older versions opened in Windows file explorer with “right click and open with” did not show this behavior.

Since there are ways to open such old documents, my intention is to document my observations and to find out if others can reproduce it. If not, my setup might differ from default or the file has an issue.

Here is a demonstration involving two decision problems (where evalf is applied to the output for better readability): 
 

interface(version);

restart;

`Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`

(1)

RealDomain:-solve({x*y = 3*z^5+4, x^2*y^2-3*x^2*z^2 = 1., x^3+y^3+z^3 = 12})

{x = 2.948903259, y = -2.257458014, z = -1.288554964}, {x = -.7294615910, y = 2.402430460, z = -1.139060479}, {x = .6177631401, y = 2.331476708, z = -.9687540923}, {x = 2.113678892, y = 1.450731881, z = -.7917893433}

(2)

SMTLIB:-Satisfy({x*y = 3*z^5+4, x^2*y^2-3*x^2*z^2 = 1, x^3+y^3+z^3 = 12}, showsmtlib)

(declare-fun x () Real)
(declare-fun y () Real)
(declare-fun z () Real)
(assert (and (= (* x y) (+ (* (* z z z z z) 3) 4)) (= (+ (* (* x x) (* y y)) (* (* (* x x) (* z z)) (- 3))) 1) (= (+ (* x x x) (* y y y) (* z z z)) 12)))
(check-sat)
(exit)

 

Error, (in SMTLIB:-smtlib_execute) external linking: error loading external library mplsmtlib.dll: Ҳ���ָ����ģ�顣

 

RealDomain:-solve({(x^2-2*y*z)*(x^3-y+z) = 0, x^4-y*z^3 = 2., z^4+x^3-2*x*y+3*y*z = 0})

{x = -1.130532018, y = -.1818551573, z = 1.263080805}, {x = 1.123233144, y = .4467032548, z = -.9704268675}, {x = 1.250562423, y = 2.517328867, z = .5615663246}, {x = 2.489770959, y = 16.73009962, z = 1.296110460}, {x = -1.336432744, y = -.7736167557, z = -1.154352246}, {x = 1.209937072, y = 1.655230257, z = .4422187526}

(3)

SMTLIB:-Satisfy({(x^2-2*y*z)*(x^3-y+z) = 0, x^4-y*z^3 = 2, z^4+x^3-2*x*y+3*y*z = 0}, showsmtlib)

(declare-fun x () Real)
(declare-fun y () Real)
(declare-fun z () Real)
(assert (and (= (* (+ (* x x) (* (* y z) (- 2))) (+ (* x x x) (* y (- 1)) z)) 0) (= (- (* x x x x) (* y (* z z z))) 2) (= (+ (* z z z z) (* x x x) (* (* x y) (- 2)) (* (* y z) 3)) 0)))
(check-sat)
(exit)

 

Error, (in SMTLIB:-smtlib_execute) external linking: error loading external library mplsmtlib.dll: Ҳ���ָ����ģ�顣

 

?SMTLIB:-Satisfy


 

Download SMTLIB[Satisfy].mw

As you can see, the SMTLIB:-Satisfy command fails to work in Maple 2023, and I have to install the Visual Studio 2013 (VC++ 12.0) manually. But unfortunately, even if I have installed the vcredist_x64.exe beforehand, the computation still cannot be done in 1000 seconds! (Please note that I just require one real instance rather than all solutions.) Does anyone know why? 
By the way, since the default SMT solver (in Maple 2023) is Z3, will another SMT solver (like cvc5) be supported in future Maple releases?

First 18 19 20 21 22 23 24 Last Page 20 of 2234