Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@Simon Willerton Using indexed names sometimes gives (unexpected) problems because of the meaning an attached [..] also has.

Try

LinearMultivariateSystem({ a[1] + a[2] = 1, a[1] > 0, a[2] > 1, a[3] > 0 }, {a[1],a[2],a[3]});

and you will see a weird error message.

To construct names like f1, f2, etc. you can use cat, as in

seq(cat(f,k),k=1..3);

Or after the fact:

evalindets([{ a[1] + a[2] = 1, a[1] > 0, a[2] > 1, a[3] > 0 }, {a[1],a[2],a[3]}],indexed,x->cat(op(0,x),op(1,x)));

and then

LinearMultivariateSystem(op(%));

@Simon Willerton Using indexed names sometimes gives (unexpected) problems because of the meaning an attached [..] also has.

Try

LinearMultivariateSystem({ a[1] + a[2] = 1, a[1] > 0, a[2] > 1, a[3] > 0 }, {a[1],a[2],a[3]});

and you will see a weird error message.

To construct names like f1, f2, etc. you can use cat, as in

seq(cat(f,k),k=1..3);

Or after the fact:

evalindets([{ a[1] + a[2] = 1, a[1] > 0, a[2] > 1, a[3] > 0 }, {a[1],a[2],a[3]}],indexed,x->cat(op(0,x),op(1,x)));

and then

LinearMultivariateSystem(op(%));

In Maple 15 and 16 the result is the correct NULL (i.e. no solution):

solve({ a + b = 1, a > 0, b > 1 }, {a,b});

However, the result of

solve({ a + b + c = 1, a > 0, b > 1, c > 0 }, {a,b,c});

is also wrong.


It is the same in Maple 16.

As always you are more likely to get useful answers if you provide us with all the details.

Could you give us the pde and the ibc the way you gave it to Maple? (Text please).

Quite right, we don't need printed manuals.

But please, don't say you stop printing manuals to help save the environment.

Stopping because it does not make sense economically is a good enough reason!

@STHence This appears to me to be the same problem raised earlier: There is no solution for X0 to Y0=C.X0.

But if you accept the next best to a solution, a leastsquare solution, then it is not surprising that with Y defined from the X we found based on that X0 by

Y:=C.X:
# we shall see a nonnegligible difference here:
(eval(Y,t=0)-convert(Y0,Vector))[1];

In your graph you have what you call the real solution. Where does that come from?

@STHence This appears to me to be the same problem raised earlier: There is no solution for X0 to Y0=C.X0.

But if you accept the next best to a solution, a leastsquare solution, then it is not surprising that with Y defined from the X we found based on that X0 by

Y:=C.X:
# we shall see a nonnegligible difference here:
(eval(Y,t=0)-convert(Y0,Vector))[1];

In your graph you have what you call the real solution. Where does that come from?

@STHence If X(0) is not known, but is just

X0:= <seq(x0[i],i=1..7)>;

then you can still compute E.X0, but then you are faced with having to solve Y = C.X w.r.t. X0 in some "best" way.

@STHence If X(0) is not known, but is just

X0:= <seq(x0[i],i=1..7)>;

then you can still compute E.X0, but then you are faced with having to solve Y = C.X w.r.t. X0 in some "best" way.

@STHence Somehow angular brackets often disappear when you paste them into the editor.

X was supposed to be
X:=<seq(x[i](t),i=1..7)>;

that is the same as

X:=Vector([seq(x[i](t),i=1..7)]);

which is safer with this editor, but not as convenient. I have corrected it above. I hope it stays OK.

@STHence Somehow angular brackets often disappear when you paste them into the editor.

X was supposed to be
X:=<seq(x[i](t),i=1..7)>;

that is the same as

X:=Vector([seq(x[i](t),i=1..7)]);

which is safer with this editor, but not as convenient. I have corrected it above. I hope it stays OK.

@STHence The LeastSquare solution minimizes the 2-norm of the residual A.X-Y. So in what sense do you expect a better solution than that?

X:=LinearAlgebra:-LeastSquares(A,Y);
A.X-Y:
LinearAlgebra:-Norm(%,2);
#Returns 0.1478777205
#LeastSquare does the same as the following (not codewise):
use LinearAlgebra in
   LinearSolve(Transpose(A).A,Transpose(A).Y)
end use;

@STHence The LeastSquare solution minimizes the 2-norm of the residual A.X-Y. So in what sense do you expect a better solution than that?

X:=LinearAlgebra:-LeastSquares(A,Y);
A.X-Y:
LinearAlgebra:-Norm(%,2);
#Returns 0.1478777205
#LeastSquare does the same as the following (not codewise):
use LinearAlgebra in
   LinearSolve(Transpose(A).A,Transpose(A).Y)
end use;

First 183 184 185 186 187 188 189 Last Page 185 of 231