vv

13837 Reputation

20 Badges

9 years, 320 days

MaplePrimes Activity


These are answers submitted by vv

Usually, select or map produce shorter and faster solutions than a loop.

select(`>`, L, 0) /~ 2;

 

DD:=(n,alpha) -> Matrix(n+1, (i,k) -> sum(omega(i-1,j,k-1), j=ceil(alpha)..n)):
DD(2,alpha);

It remains to define your function omega:

omega := (i,j,l) -> ...

Yes, in Maple 2019 it is recommended to use

g := x-> local j; sum(..., j=1..5);

 

I have used DirectSearch, a reliable and free global optimizer (see  Maple Application Center).
Note that your model does not seem to be perfect for your data.

 

 

restart;

libname := "d:\\ds2", libname:

with(DirectSearch):

Digits:=15:

X := Vector([0, 100, 200, 300, 400, 500], datatype = float):
Y := Vector([0.2e-2, 0.5e-2, 0.7e-2, 0.75e-2, 0.77e-2, 0.8e-2], datatype = float):

f:=1/25000*(-100*a*b*(c-1)^2*exp(-1/100*(b*c+a)*t/c/(a+b))+((t+100)*a+100*c*(c+1/
100*t)*b)*(a+b))/(a+b)/(b*c+a)^2;

(1/25000)*(-100*a*b*(c-1)^2*exp(-(1/100)*(b*c+a)*t/(c*(a+b)))+((t+100)*a+100*c*(c+(1/100)*t)*b)*(a+b))/((a+b)*(b*c+a)^2)

(1)

sol:=DataFit(f,X,Y,t, [a=0..1, b=0..1, c=0..1, a+b+c=1]);

[HFloat(8.625680307110638e-5), [a = HFloat(0.9999995216155494), b = HFloat(1.5510602944156731e-7), c = HFloat(3.2768524715027054e-7)], 152]

(2)

F:=eval(f, sol[2]);

-HFloat(6.204242085295688e-10)*exp(-HFloat(30517.084720490617)*t)+HFloat(4.0000019135385154e-5)*t+HFloat(0.004000001913538312)

(3)

seq([Y[i], err=eval(F,t=X[i]) - Y[i]], i=1..numelems(X));

[HFloat(0.0020), err = HFloat(0.0020000012931141037)], [HFloat(0.0050), err = HFloat(0.0030000038270768274)], [HFloat(0.0070), err = HFloat(0.0050000057406153426)], [HFloat(0.0075), err = HFloat(0.00850000765415386)], [HFloat(0.0077), err = HFloat(0.012300009567692371)], [HFloat(0.0080), err = HFloat(0.01600001148123089)]

(4)

 


plots:-display(plot(F, t=0..500), plot(X,Y, style=point, color=blue, symbolsize=16));

 

The 0 value can be obtained as an Abel (generalized) summation:

sum(sin(Pi*n/2)*sin(n*Pi*(x + 1)/2)*cos(n*Pi*t/2) * z^n, n=1..infinity) assuming z>0,z<1:

limit(%, z=1, left);
      0

 

Your piecewise function f is not a "classical" solution of the ODE y' = 0  because as you see, f is not differentiable at some points.

There are also "generalized" solutions,  see wiki, where the function must satisfy the ODE only a.e. (almost everywhere, i.e. except on a null set), but the function must be absolutely continuous. Your piecewise funcion is not even continuous, so it is still not a solution in this wider sense.
Note that there are other contexts (e.g. distributional derivatives), but I'll stop here.

 

You essentially compare

eval(floor(n), n=1);   # 1
limit(floor(n), n=1);  # undefined

and conclude 1 = undefined (+ something about a prize).

You should be aware that floor is not continuous at 1.

 

 

LibLocation:="C:/temp/MyLib.mla": # dir with write access
LibraryTools:-Create(LibLocation); # if the library is new
LibraryTools:-Save(MyMat, LibLocation);
restart;  # check
LibLocation:="C:/temp/MyLib.mla";
libname:=LibLocation, libname;
with(MyMat);

(The path is for Windows.)

The command works for any m, provided that A in invertible mod m. You can even use e.g.

A:=<2,7;3,2>:
1/A mod 10;
   

% . A mod 10;  # check

   

You may also use:
LinearAlgebra:-Modular:-Inverse(m, A);
[which is faster for large matrices]

Note that A is invertible mod m iff det(A) and m  are relatively prime.

 

Maple is not needed for this. k=0 obviously satisfies the condition.
For any integer k>0, a(n) cannot be integer if n is large enough (because the distance between two consecutive squares --> oo).

Edit. The answer refers to the recurrence  a(n+1) = 3*a(n)+sqrt(4*a(n)^2+k), a(1)=1.
As I see, the OP changes (without notice) the problem every  half hour.
Answering the new one is very risky!

 

F := unapply(int(z^(-1/2), z), z);
              F := z -> 2*sqrt(z)
limit(F(-1-I*y),y=0, right) - F(1);
            
-2 - 2*I

 

If you know the factorization, just add it to the remember table of ifactors:

ifactors(n):=[1, [[p, 1], [q, 1]]];

and then call ModularSquareRoot.

 

Note first that in Maple 2019 the last 3 examples work as expected.

 

The value of exp at "complex infinities" (and for other functions too) seems to be more or less arbitrary in Maple. It is not necessarily related to limit.

It seems to be based on some maths + syntax + heuristics.

So, many weird consequences are to be expected.

 

exp(I-infinity);

infinity*I

(1)

exp(sqrt(2)*I-infinity);

exp(I*2^(1/2)-infinity)

(2)

simplify(%); # ???

1

(3)

exp(I+infinity);

infinity+infinity*I

(4)

exp(sqrt(2)*I+infinity);

exp(I*2^(1/2)+infinity)

(5)

simplify(%); # ???

1

(6)

 

Note that some properties e.g. complex, real, rational, irrational, are practically not defined in the help pages; only some information about the property tree are mentioned. They are supposed to reflect the mathematical sense.

And the assume facility is far from perfect.

 

is(Pi + exp(1), rational); # should be FAIL

false

(7)

is(Pi + exp(1), irrational);

FAIL

(8)

coulditbe(x+Pi+exp(1), rational) assuming x::rational;

FAIL

(9)

coulditbe(x+Pi+exp(1), irrational) assuming x::irrational;

FAIL

(10)

The last answer should be true: simply take x = - Pi.

is(Pi, OrProp(rational, irrational));

true

(11)

is(Pi + exp(1), OrProp(rational, irrational));  # ???

FAIL

(12)

In  GroupTheory the Dihedral group is represented as a permutation group.

Note that your representation is for N=4, not N=8.
Here is the general case.

restart;

interface(rtablesize=16);

[10, 10]

(1)

# R0:=<1,0;0,1>;R1:=<0,-1;1,0>; R2:=<-1,0;0,1>; R3:=<0, 1;-1,0>;S0:=<1,0;0, -1>; S1:=<0,1;1, 0>; S2:=<-1,0;0,1>; S3:=<0,-1;-1,0>;

rot:=(n,k) -> <cos(2*k*Pi/n), -sin(2*k*Pi/n); sin(2*k*Pi/n), cos(2*k*Pi/n)>;

proc (n, k) options operator, arrow; `<,>`(`<|>`(cos(2*k*Pi/n), -sin(2*k*Pi/n)), `<|>`(sin(2*k*Pi/n), cos(2*k*Pi/n))) end proc

(2)

sym:=(n,k) -> <cos(2*k*Pi/n), +sin(2*k*Pi/n); sin(2*k*Pi/n), -cos(2*k*Pi/n)>;

proc (n, k) options operator, arrow; `<,>`(`<|>`(cos(2*k*Pi/n), sin(2*k*Pi/n)), `<|>`(sin(2*k*Pi/n), -cos(2*k*Pi/n))) end proc

(3)

N:=8;

8

(4)

di[N]:=seq(rot(N,k),k=0..N-1), seq(sym(N,k),k=0..N-1);

di[8] := Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1}), Matrix(2, 2, {(1, 1) = (1/2)*sqrt(2), (1, 2) = -(1/2)*sqrt(2), (2, 1) = (1/2)*sqrt(2), (2, 2) = (1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = 0, (1, 2) = -1, (2, 1) = 1, (2, 2) = 0}), Matrix(2, 2, {(1, 1) = -(1/2)*sqrt(2), (1, 2) = -(1/2)*sqrt(2), (2, 1) = (1/2)*sqrt(2), (2, 2) = -(1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = -1, (1, 2) = 0, (2, 1) = 0, (2, 2) = -1}), Matrix(2, 2, {(1, 1) = -(1/2)*sqrt(2), (1, 2) = (1/2)*sqrt(2), (2, 1) = -(1/2)*sqrt(2), (2, 2) = -(1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = 0, (1, 2) = 1, (2, 1) = -1, (2, 2) = 0}), Matrix(2, 2, {(1, 1) = (1/2)*sqrt(2), (1, 2) = (1/2)*sqrt(2), (2, 1) = -(1/2)*sqrt(2), (2, 2) = (1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 1) = 0, (2, 2) = -1}), Matrix(2, 2, {(1, 1) = (1/2)*sqrt(2), (1, 2) = (1/2)*sqrt(2), (2, 1) = (1/2)*sqrt(2), (2, 2) = -(1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = 0, (1, 2) = 1, (2, 1) = 1, (2, 2) = 0}), Matrix(2, 2, {(1, 1) = -(1/2)*sqrt(2), (1, 2) = (1/2)*sqrt(2), (2, 1) = (1/2)*sqrt(2), (2, 2) = (1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = -1, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1}), Matrix(2, 2, {(1, 1) = -(1/2)*sqrt(2), (1, 2) = -(1/2)*sqrt(2), (2, 1) = -(1/2)*sqrt(2), (2, 2) = (1/2)*sqrt(2)}), Matrix(2, 2, {(1, 1) = 0, (1, 2) = -1, (2, 1) = -1, (2, 2) = 0}), Matrix(2, 2, {(1, 1) = (1/2)*sqrt(2), (1, 2) = -(1/2)*sqrt(2), (2, 1) = -(1/2)*sqrt(2), (2, 2) = -(1/2)*sqrt(2)})

(5)

cay:=Matrix(2*N, (i,j)->[seq(di[N][i].di[N][j])]): # converted to lists

Cay:=eval(cay, [seq([seq(di[N][k])]=k,k=1..2*N)]); # Cayley table

Matrix(16, 16, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 3, (1, 4) = 4, (1, 5) = 5, (1, 6) = 6, (1, 7) = 7, (1, 8) = 8, (1, 9) = 9, (1, 10) = 10, (1, 11) = 11, (1, 12) = 12, (1, 13) = 13, (1, 14) = 14, (1, 15) = 15, (1, 16) = 16, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4, (2, 4) = 5, (2, 5) = 6, (2, 6) = 7, (2, 7) = 8, (2, 8) = 1, (2, 9) = 10, (2, 10) = 11, (2, 11) = 12, (2, 12) = 13, (2, 13) = 14, (2, 14) = 15, (2, 15) = 16, (2, 16) = 9, (3, 1) = 3, (3, 2) = 4, (3, 3) = 5, (3, 4) = 6, (3, 5) = 7, (3, 6) = 8, (3, 7) = 1, (3, 8) = 2, (3, 9) = 11, (3, 10) = 12, (3, 11) = 13, (3, 12) = 14, (3, 13) = 15, (3, 14) = 16, (3, 15) = 9, (3, 16) = 10, (4, 1) = 4, (4, 2) = 5, (4, 3) = 6, (4, 4) = 7, (4, 5) = 8, (4, 6) = 1, (4, 7) = 2, (4, 8) = 3, (4, 9) = 12, (4, 10) = 13, (4, 11) = 14, (4, 12) = 15, (4, 13) = 16, (4, 14) = 9, (4, 15) = 10, (4, 16) = 11, (5, 1) = 5, (5, 2) = 6, (5, 3) = 7, (5, 4) = 8, (5, 5) = 1, (5, 6) = 2, (5, 7) = 3, (5, 8) = 4, (5, 9) = 13, (5, 10) = 14, (5, 11) = 15, (5, 12) = 16, (5, 13) = 9, (5, 14) = 10, (5, 15) = 11, (5, 16) = 12, (6, 1) = 6, (6, 2) = 7, (6, 3) = 8, (6, 4) = 1, (6, 5) = 2, (6, 6) = 3, (6, 7) = 4, (6, 8) = 5, (6, 9) = 14, (6, 10) = 15, (6, 11) = 16, (6, 12) = 9, (6, 13) = 10, (6, 14) = 11, (6, 15) = 12, (6, 16) = 13, (7, 1) = 7, (7, 2) = 8, (7, 3) = 1, (7, 4) = 2, (7, 5) = 3, (7, 6) = 4, (7, 7) = 5, (7, 8) = 6, (7, 9) = 15, (7, 10) = 16, (7, 11) = 9, (7, 12) = 10, (7, 13) = 11, (7, 14) = 12, (7, 15) = 13, (7, 16) = 14, (8, 1) = 8, (8, 2) = 1, (8, 3) = 2, (8, 4) = 3, (8, 5) = 4, (8, 6) = 5, (8, 7) = 6, (8, 8) = 7, (8, 9) = 16, (8, 10) = 9, (8, 11) = 10, (8, 12) = 11, (8, 13) = 12, (8, 14) = 13, (8, 15) = 14, (8, 16) = 15, (9, 1) = 9, (9, 2) = 16, (9, 3) = 15, (9, 4) = 14, (9, 5) = 13, (9, 6) = 12, (9, 7) = 11, (9, 8) = 10, (9, 9) = 1, (9, 10) = 8, (9, 11) = 7, (9, 12) = 6, (9, 13) = 5, (9, 14) = 4, (9, 15) = 3, (9, 16) = 2, (10, 1) = 10, (10, 2) = 9, (10, 3) = 16, (10, 4) = 15, (10, 5) = 14, (10, 6) = 13, (10, 7) = 12, (10, 8) = 11, (10, 9) = 2, (10, 10) = 1, (10, 11) = 8, (10, 12) = 7, (10, 13) = 6, (10, 14) = 5, (10, 15) = 4, (10, 16) = 3, (11, 1) = 11, (11, 2) = 10, (11, 3) = 9, (11, 4) = 16, (11, 5) = 15, (11, 6) = 14, (11, 7) = 13, (11, 8) = 12, (11, 9) = 3, (11, 10) = 2, (11, 11) = 1, (11, 12) = 8, (11, 13) = 7, (11, 14) = 6, (11, 15) = 5, (11, 16) = 4, (12, 1) = 12, (12, 2) = 11, (12, 3) = 10, (12, 4) = 9, (12, 5) = 16, (12, 6) = 15, (12, 7) = 14, (12, 8) = 13, (12, 9) = 4, (12, 10) = 3, (12, 11) = 2, (12, 12) = 1, (12, 13) = 8, (12, 14) = 7, (12, 15) = 6, (12, 16) = 5, (13, 1) = 13, (13, 2) = 12, (13, 3) = 11, (13, 4) = 10, (13, 5) = 9, (13, 6) = 16, (13, 7) = 15, (13, 8) = 14, (13, 9) = 5, (13, 10) = 4, (13, 11) = 3, (13, 12) = 2, (13, 13) = 1, (13, 14) = 8, (13, 15) = 7, (13, 16) = 6, (14, 1) = 14, (14, 2) = 13, (14, 3) = 12, (14, 4) = 11, (14, 5) = 10, (14, 6) = 9, (14, 7) = 16, (14, 8) = 15, (14, 9) = 6, (14, 10) = 5, (14, 11) = 4, (14, 12) = 3, (14, 13) = 2, (14, 14) = 1, (14, 15) = 8, (14, 16) = 7, (15, 1) = 15, (15, 2) = 14, (15, 3) = 13, (15, 4) = 12, (15, 5) = 11, (15, 6) = 10, (15, 7) = 9, (15, 8) = 16, (15, 9) = 7, (15, 10) = 6, (15, 11) = 5, (15, 12) = 4, (15, 13) = 3, (15, 14) = 2, (15, 15) = 1, (15, 16) = 8, (16, 1) = 16, (16, 2) = 15, (16, 3) = 14, (16, 4) = 13, (16, 5) = 12, (16, 6) = 11, (16, 7) = 10, (16, 8) = 9, (16, 9) = 8, (16, 10) = 7, (16, 11) = 6, (16, 12) = 5, (16, 13) = 4, (16, 14) = 3, (16, 15) = 2, (16, 16) = 1})

(6)

with(GroupTheory):

Di:=CayleyTableGroup(Cay, check);

GroupTheory:-CayleyTableGroup(Matrix(16, 16, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 3, (1, 4) = 4, (1, 5) = 5, (1, 6) = 6, (1, 7) = 7, (1, 8) = 8, (1, 9) = 9, (1, 10) = 10, (1, 11) = 11, (1, 12) = 12, (1, 13) = 13, (1, 14) = 14, (1, 15) = 15, (1, 16) = 16, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4, (2, 4) = 5, (2, 5) = 6, (2, 6) = 7, (2, 7) = 8, (2, 8) = 1, (2, 9) = 10, (2, 10) = 11, (2, 11) = 12, (2, 12) = 13, (2, 13) = 14, (2, 14) = 15, (2, 15) = 16, (2, 16) = 9, (3, 1) = 3, (3, 2) = 4, (3, 3) = 5, (3, 4) = 6, (3, 5) = 7, (3, 6) = 8, (3, 7) = 1, (3, 8) = 2, (3, 9) = 11, (3, 10) = 12, (3, 11) = 13, (3, 12) = 14, (3, 13) = 15, (3, 14) = 16, (3, 15) = 9, (3, 16) = 10, (4, 1) = 4, (4, 2) = 5, (4, 3) = 6, (4, 4) = 7, (4, 5) = 8, (4, 6) = 1, (4, 7) = 2, (4, 8) = 3, (4, 9) = 12, (4, 10) = 13, (4, 11) = 14, (4, 12) = 15, (4, 13) = 16, (4, 14) = 9, (4, 15) = 10, (4, 16) = 11, (5, 1) = 5, (5, 2) = 6, (5, 3) = 7, (5, 4) = 8, (5, 5) = 1, (5, 6) = 2, (5, 7) = 3, (5, 8) = 4, (5, 9) = 13, (5, 10) = 14, (5, 11) = 15, (5, 12) = 16, (5, 13) = 9, (5, 14) = 10, (5, 15) = 11, (5, 16) = 12, (6, 1) = 6, (6, 2) = 7, (6, 3) = 8, (6, 4) = 1, (6, 5) = 2, (6, 6) = 3, (6, 7) = 4, (6, 8) = 5, (6, 9) = 14, (6, 10) = 15, (6, 11) = 16, (6, 12) = 9, (6, 13) = 10, (6, 14) = 11, (6, 15) = 12, (6, 16) = 13, (7, 1) = 7, (7, 2) = 8, (7, 3) = 1, (7, 4) = 2, (7, 5) = 3, (7, 6) = 4, (7, 7) = 5, (7, 8) = 6, (7, 9) = 15, (7, 10) = 16, (7, 11) = 9, (7, 12) = 10, (7, 13) = 11, (7, 14) = 12, (7, 15) = 13, (7, 16) = 14, (8, 1) = 8, (8, 2) = 1, (8, 3) = 2, (8, 4) = 3, (8, 5) = 4, (8, 6) = 5, (8, 7) = 6, (8, 8) = 7, (8, 9) = 16, (8, 10) = 9, (8, 11) = 10, (8, 12) = 11, (8, 13) = 12, (8, 14) = 13, (8, 15) = 14, (8, 16) = 15, (9, 1) = 9, (9, 2) = 16, (9, 3) = 15, (9, 4) = 14, (9, 5) = 13, (9, 6) = 12, (9, 7) = 11, (9, 8) = 10, (9, 9) = 1, (9, 10) = 8, (9, 11) = 7, (9, 12) = 6, (9, 13) = 5, (9, 14) = 4, (9, 15) = 3, (9, 16) = 2, (10, 1) = 10, (10, 2) = 9, (10, 3) = 16, (10, 4) = 15, (10, 5) = 14, (10, 6) = 13, (10, 7) = 12, (10, 8) = 11, (10, 9) = 2, (10, 10) = 1, (10, 11) = 8, (10, 12) = 7, (10, 13) = 6, (10, 14) = 5, (10, 15) = 4, (10, 16) = 3, (11, 1) = 11, (11, 2) = 10, (11, 3) = 9, (11, 4) = 16, (11, 5) = 15, (11, 6) = 14, (11, 7) = 13, (11, 8) = 12, (11, 9) = 3, (11, 10) = 2, (11, 11) = 1, (11, 12) = 8, (11, 13) = 7, (11, 14) = 6, (11, 15) = 5, (11, 16) = 4, (12, 1) = 12, (12, 2) = 11, (12, 3) = 10, (12, 4) = 9, (12, 5) = 16, (12, 6) = 15, (12, 7) = 14, (12, 8) = 13, (12, 9) = 4, (12, 10) = 3, (12, 11) = 2, (12, 12) = 1, (12, 13) = 8, (12, 14) = 7, (12, 15) = 6, (12, 16) = 5, (13, 1) = 13, (13, 2) = 12, (13, 3) = 11, (13, 4) = 10, (13, 5) = 9, (13, 6) = 16, (13, 7) = 15, (13, 8) = 14, (13, 9) = 5, (13, 10) = 4, (13, 11) = 3, (13, 12) = 2, (13, 13) = 1, (13, 14) = 8, (13, 15) = 7, (13, 16) = 6, (14, 1) = 14, (14, 2) = 13, (14, 3) = 12, (14, 4) = 11, (14, 5) = 10, (14, 6) = 9, (14, 7) = 16, (14, 8) = 15, (14, 9) = 6, (14, 10) = 5, (14, 11) = 4, (14, 12) = 3, (14, 13) = 2, (14, 14) = 1, (14, 15) = 8, (14, 16) = 7, (15, 1) = 15, (15, 2) = 14, (15, 3) = 13, (15, 4) = 12, (15, 5) = 11, (15, 6) = 10, (15, 7) = 9, (15, 8) = 16, (15, 9) = 7, (15, 10) = 6, (15, 11) = 5, (15, 12) = 4, (15, 13) = 3, (15, 14) = 2, (15, 15) = 1, (15, 16) = 8, (16, 1) = 16, (16, 2) = 15, (16, 3) = 14, (16, 4) = 13, (16, 5) = 12, (16, 6) = 11, (16, 7) = 10, (16, 8) = 9, (16, 9) = 8, (16, 10) = 7, (16, 11) = 6, (16, 12) = 5, (16, 13) = 4, (16, 14) = 3, (16, 15) = 2, (16, 16) = 1}))

(7)

AreIsomorphic(Di,DihedralGroup(N))

true

(8)

 


Download Dihedral.mw

J:=Int(sqrt(1+(diff(sqrt(R^2-(x-R)^2), x))^2), x = 0 .. 2*R):
IntegrationTools:-Change(J, x=R*t, t) assuming R>0:
value(%);

     R * Pi

First 46 47 48 49 50 51 52 Last Page 48 of 120