Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

You are more likely to get good answers if you provide us with the details, e.g. in the form of an uploaded worksheet or the complete lines of code pasted into your posting.

I don't have that problem in Maple 15. In Maple 12, however, I do. But if you change the range to 0..2*Pi as in

odeplot(res,[e1r(t),e1i(t)],0..2*Pi,refine=1);

the error doesn't appear. Alternatively, change the range in the assignment to res like this:

res:=dsolve(s1 union s2,numeric, method =rkf45_dae,abserr=10^(-10),relerr=10^(-10),range=0..Pi,maxfun = 0,output=listprocedure);

I don't have that problem in Maple 15. In Maple 12, however, I do. But if you change the range to 0..2*Pi as in

odeplot(res,[e1r(t),e1i(t)],0..2*Pi,refine=1);

the error doesn't appear. Alternatively, change the range in the assignment to res like this:

res:=dsolve(s1 union s2,numeric, method =rkf45_dae,abserr=10^(-10),relerr=10^(-10),range=0..Pi,maxfun = 0,output=listprocedure);

@nic_rf Well, then f(t) = 1-exp(-t) is the solution. The laplace transform method using f(0) = 0 gave two possible solutions, but with f ' (0) > 0 one is singled out, i.e. f(t) = 1-exp(-t).

@nic_rf Well, then f(t) = 1-exp(-t) is the solution. The laplace transform method using f(0) = 0 gave two possible solutions, but with f ' (0) > 0 one is singled out, i.e. f(t) = 1-exp(-t).

@PatrickT You can make use of 'satisfies' as in

RNN(M,1,'satisfies'(s->s::realcons and s>0 and s<30));

if you change RNN to accept as the third argument either a regular type or the special function 'satisfies'.

(This is still not perfect, since combining those two with And, Or, or Not won't work).

RNN:= proc(M::{Array,Matrix},k::posint, t::{type,specfunc(procedure,satisfies)}:=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 You can make use of 'satisfies' as in

RNN(M,1,'satisfies'(s->s::realcons and s>0 and s<30));

if you change RNN to accept as the third argument either a regular type or the special function 'satisfies'.

(This is still not perfect, since combining those two with And, Or, or Not won't work).

RNN:= proc(M::{Array,Matrix},k::posint, t::{type,specfunc(procedure,satisfies)}:=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 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 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);

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