acer

32747 Reputation

29 Badges

20 years, 112 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

I have a 2-player game engine, which I've used to program mancala and chess in maple. (the chess is weak because a strong engine needs more ply/sec than interpreted maple can do, and I haven't Compiled it yet.) A Blokus plugin wouldn't be hard. I used variants of alpha-beta/minimax & negamax tree-pruning algorithms for the engine. (mancala allows multiple moves/turn situations, making it more interesting. ) I'm on vacation with poor connectivity, so cannot write more this week. )

acer

I believe that, yes, it is an issue of a global, unassumed n versus a local, assumed n. But I think that it is the opposite situation, and that the SubMatrix result is the one with the global n.

An evaluation of the sub-Matrix is then what is needed, and that can be done with either copy or inplace semantics.

acer

I believe that, yes, it is an issue of a global, unassumed n versus a local, assumed n. But I think that it is the opposite situation, and that the SubMatrix result is the one with the global n.

An evaluation of the sub-Matrix is then what is needed, and that can be done with either copy or inplace semantics.

acer

@Alejandro Jakubi Yes, thanks Alejandro, I realized that that was the situation.

And, while "dynamic binding" of some sort might be nice for Maple, this present behaviour doesn't seem so good to me (and I don't recall seeing the Maple 9->9.5 behavioural change as documented).

It looks more unfortunate, that some rebinding affects ":-LinearAlgebra:-MatrixInverse" even after the initial binding of `MatrixInverse`. I would have thought that :-LinearAlgebra:-MatrixInverse was bound, "simpl'd", and no longer dynamic. (It was like that for the first 4 years of modules' existence in Maple.)

It pulls the rug out, unexpectedly. I think that the OP's situation demonstrates this.

@Alejandro Jakubi Yes, thanks Alejandro, I realized that that was the situation.

And, while "dynamic binding" of some sort might be nice for Maple, this present behaviour doesn't seem so good to me (and I don't recall seeing the Maple 9->9.5 behavioural change as documented).

It looks more unfortunate, that some rebinding affects ":-LinearAlgebra:-MatrixInverse" even after the initial binding of `MatrixInverse`. I would have thought that :-LinearAlgebra:-MatrixInverse was bound, "simpl'd", and no longer dynamic. (It was like that for the first 4 years of modules' existence in Maple.)

It pulls the rug out, unexpectedly. I think that the OP's situation demonstrates this.

@corregumucio Ok. It can still be as flexible, without actual assignment.

> restart:

> eqxy1:=x+2*y=4:
> eqxy2:=x^2+y^2=16:

> xysol:=solve({eqxy1,eqxy2},Explicit);
                               /    -12      16\ 
              {x = 4, y = 0}, { x = ---, y = -- }
                               \     5       5 / 

> x=eval(x,xysol[1]);
                             x = 4

> eqrsxy1:=s*x+y^2*r=11;
                               2       
                        s x + y  r = 11

> eval( eqrsxy1, [x=eval(x,xysol[1])] );
                               2       
                        4 s + y  r = 11

@corregumucio Ok. It can still be as flexible, without actual assignment.

> restart:

> eqxy1:=x+2*y=4:
> eqxy2:=x^2+y^2=16:

> xysol:=solve({eqxy1,eqxy2},Explicit);
                               /    -12      16\ 
              {x = 4, y = 0}, { x = ---, y = -- }
                               \     5       5 / 

> x=eval(x,xysol[1]);
                             x = 4

> eqrsxy1:=s*x+y^2*r=11;
                               2       
                        s x + y  r = 11

> eval( eqrsxy1, [x=eval(x,xysol[1])] );
                               2       
                        4 s + y  r = 11

And I guess I didn't give this shorter one before,

> restart:
> with(LinearAlgebra):
> with(Student):

> MatrixInverse(Matrix([[4]]));
Error, MatrixInverse is not a command in the LinearAlgebra package

acer

And I guess I didn't give this shorter one before,

> restart:
> with(LinearAlgebra):
> with(Student):

> MatrixInverse(Matrix([[4]]));
Error, MatrixInverse is not a command in the LinearAlgebra package

acer

Ahh. It looks like it all worked in Maple 9, and that my 2nd and 3rd examples changed behaviour starting with Maple 9.5.

acer

Ahh. It looks like it all worked in Maple 9, and that my 2nd and 3rd examples changed behaviour starting with Maple 9.5.

acer

The Standard GUI no longer seems able to display the intermediary objects with attributes on them. (That fact is hidden, if one immediately sorts them and returns the underlying attributes instead, in just a single command.) This seems to have changed between Maple 11 and 12.

acer

See here for a look at question 2.

acer

@afeddersen ExpectedValue computes the integral of x*f(x) for density function f, where the `x` weight is unstated (ie. implicit) but automatically inserted. So if you want to replace that implicit weight x by U(x), while using a new random variable to supply directly to ExpectedValue, then its PDF must be weighted by U(x)/x. It'd look like this, then,

with(Statistics):
assume(mu::real,sigma>0);
X:=RandomVariable(Normal(mu,sigma)):
Y:=RandomVariable(Distribution(PDF=subs(f=unapply(PDF(X,T),T),t->(1-exp(-phi*t))/t*f(t)))):
EY:=ExpectedValue(Y);

and it does indeed get the same result.

@afeddersen ExpectedValue computes the integral of x*f(x) for density function f, where the `x` weight is unstated (ie. implicit) but automatically inserted. So if you want to replace that implicit weight x by U(x), while using a new random variable to supply directly to ExpectedValue, then its PDF must be weighted by U(x)/x. It'd look like this, then,

with(Statistics):
assume(mu::real,sigma>0);
X:=RandomVariable(Normal(mu,sigma)):
Y:=RandomVariable(Distribution(PDF=subs(f=unapply(PDF(X,T),T),t->(1-exp(-phi*t))/t*f(t)))):
EY:=ExpectedValue(Y);

and it does indeed get the same result.

First 461 462 463 464 465 466 467 Last Page 463 of 600