Preben Alsholm

13743 Reputation

22 Badges

20 years, 333 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@PatrickT Type real doesn't exist, so in the call

RNN(M,1,real);

RNN will use the default type, i.e. numeric.   RNN(M,1,xxx); has the same effect.

In order to catch such user errors you could place a dollar sign at the end of the sequence of formal parameters, indicating thereby that no other arguments are allowed. Alternatively the third argument t::type could be made required.

RNN:= proc(M::{Array,Matrix},k::posint, t::type:=numeric,$)
  local U,d,i,dk;
  d:= [rtable_dims(M)];
  U:= remove(r -> hastype(M[op(subsop(k=r,d))],Not(t),'exclude_container'),[seq(i,i=d[k])]);
  M[op(subsop(k=U,d))]
end proc;

@PatrickT Here is a way.

M:=Matrix([[HFloat(undefined),HFloat(undefined),HFloat(undefined)],[1,2,3],[HFloat(undefined),HFloat(undefined),HFloat(undefined)],[4,5,6]]);
m:=LinearAlgebra:-RowDimension(M):
U:=NULL:
for i to m do
   if has(LinearAlgebra:-Row(M,i),HFloat(undefined)) then U:=U,i end if
end do;
U;
LinearAlgebra:-DeleteRow(M,[U]);

@PatrickT Here is a way.

M:=Matrix([[HFloat(undefined),HFloat(undefined),HFloat(undefined)],[1,2,3],[HFloat(undefined),HFloat(undefined),HFloat(undefined)],[4,5,6]]);
m:=LinearAlgebra:-RowDimension(M):
U:=NULL:
for i to m do
   if has(LinearAlgebra:-Row(M,i),HFloat(undefined)) then U:=U,i end if
end do;
U;
LinearAlgebra:-DeleteRow(M,[U]);

It seems to me that a lot of the people reporting this problem are Danes (so am I). Is that a coincidence or what?

I haven't had that kind of problem for a very long time, maybe because I (almost) always remove all output before saving.

It seems to me that a lot of the people reporting this problem are Danes (so am I). Is that a coincidence or what?

I haven't had that kind of problem for a very long time, maybe because I (almost) always remove all output before saving.

LeastSquares work if B is converted to rational.

Bex:=convert(B,rational);
GaussianElimination(<A|Bex>);
Yp:=LeastSquares(A, Bex,free=t);
Norm(A.Yp-Bex,2);
Y:=LeastSquares(A, Bex,optimize);
Norm(A.Y-Bex,2);
evalf(%);

#Compare with your result from DirectSearch:

Yds:=<.899555775576182, .897427164193849, .896594849107632, .899558830317534>;
Norm(A.Yds-B,2);

LeastSquares work if B is converted to rational.

Bex:=convert(B,rational);
GaussianElimination(<A|Bex>);
Yp:=LeastSquares(A, Bex,free=t);
Norm(A.Yp-Bex,2);
Y:=LeastSquares(A, Bex,optimize);
Norm(A.Y-Bex,2);
evalf(%);

#Compare with your result from DirectSearch:

Yds:=<.899555775576182, .897427164193849, .896594849107632, .899558830317534>;
Norm(A.Yds-B,2);

@k4walker You are right. However, I did get 0 when I tried, but that must have been due to the fact that the order of the solutions is not guaranteed to be the same each time. So now I tried:

myDeterminant := (1/2)*l[4]*l[1]*(l[4]*cos(x[2]-2*x[3])+l[4]*cos(x[2])-l[1]*sin(2*x[2]-x[3])-l[1]*sin(x[3]));
solutions := solve(myDeterminant = 0);
eval~(myDeterminant,[solutions]);
simplify(%);
expand(%);
simplify(%);

From this we see that 5 of the 6 solutions found are correct.

@k4walker You are right. However, I did get 0 when I tried, but that must have been due to the fact that the order of the solutions is not guaranteed to be the same each time. So now I tried:

myDeterminant := (1/2)*l[4]*l[1]*(l[4]*cos(x[2]-2*x[3])+l[4]*cos(x[2])-l[1]*sin(2*x[2]-x[3])-l[1]*sin(x[3]));
solutions := solve(myDeterminant = 0);
eval~(myDeterminant,[solutions]);
simplify(%);
expand(%);
simplify(%);

From this we see that 5 of the 6 solutions found are correct.

@kh2n I misunderstood your question. Now if I understand you correctly, you just have to check if the answer provided by Maple in 'sol' is in fact correct, i.e. satisfies the ode and the bcs. This can be done by odetest:

odetest(sol,{ode, bcs});

The answer is {0}, which means that odetest says that ode and bcs are satisfied.

@kh2n I misunderstood your question. Now if I understand you correctly, you just have to check if the answer provided by Maple in 'sol' is in fact correct, i.e. satisfies the ode and the bcs. This can be done by odetest:

odetest(sol,{ode, bcs});

The answer is {0}, which means that odetest says that ode and bcs are satisfied.

@Red Horse No, the greatest in absolute value can be seen on the plot of the absolute value:

  plot(abs(diff(f,x,x)),x=-Pi/2..3*Pi/2);

@Red Horse No, the greatest in absolute value can be seen on the plot of the absolute value:

  plot(abs(diff(f,x,x)),x=-Pi/2..3*Pi/2);

You must have meant

E, V:= Eigenvectors(A);

You must have meant

E, V:= Eigenvectors(A);

First 203 204 205 206 207 208 209 Last Page 205 of 231