dharr

Dr. David Harrington

8902 Reputation

22 Badges

21 years, 136 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are replies submitted by dharr

@salim-barzani The wikipedia page has something about the analogy with trig functions. Its doubly-periodic nature can be shown in a plot:

Doubly periodic nature of the Weierstrass function. For example a hexagonal lattice with unit cell vectors in the complex plane at 60degrees apart. The poles are at the lattice points

See DLMF - 23.5.8 for lattice with omega__1  real, periodicity along the real axis = 2*omega__1. The g-invariants are

restart

g__2 := 0; g__3 := GAMMA(1/3)^18/(4*Pi*`ω__1`)^6

0

(64/19683)*Pi^12/(GAMMA(2/3)^18*omega__1^6)

omega_1 = 1.

f := WeierstrassP(z, g__2, eval(g__3, `ω__1` = 1))

WeierstrassP(z, 0, (64/19683)*Pi^12/GAMMA(2/3)^18)

p := plots:-complexplot3d(f, z = -5-5*I .. 5+5*I, view = [default, default, 0 .. 4])

Looking down

plots:-display(p, orientation = [-90, 0], style = surfacecontour)

NULL

Download Weierstrass.mw

@salim-barzani I did Eq 47 at the bottom, as in table 2. odetest gives zero.

ode-17.mw

If I put in some random values for the parameters, I don't get zero, so it doesn't seem to be a solution.

T-pde.mw

Interesting bug. I reduced it down to a smaller example within a worksheet.

This version works correctly - the bitmask bm has 1000 1's so Anding with num1 (which has fewer bits) just returns num1

restart

n := 1000; num := 124345994492475404798327875362902901992795666778727657534420884655177904531686659133645511903099791240872149553399687857146297830364878763673608694434636759773303896159506085472672670558713210501921333058462227444188822916868591893071268581049687884472831284477016171744356197692209391893001975814590875407081409079843847570753624652978353229534727345944100084962186575445080168254068349693213343402194051212518373483099158508416844494586587575956364301894537801311066848168445514196432228108255100694654760323061911666708425773177386359200866161779630276830551354956041869854482996129392080604969770318232847290083683448702192322340; bm := integermul2exp(1, n)-1

10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069375

NULL

NULL

operation := proc (num, n) local q, k; q := num; for k to 2 do q := integerdivq2exp(q, n) end do; q end proc

NULL

num1 := 1083029963437854242395921050992

1083029963437854242395921050992

num1_And_result := Bits:-And(num1, bm)

1083029963437854242395921050992

NULL

Now we do exactly the same but running "operation"  (line uncommented) before defining num1. The value of num1_And_result is now much longer - the low order bits match those of num1 but there are extra high order bits

restart

n := 1000; num := 124345994492475404798327875362902901992795666778727657534420884655177904531686659133645511903099791240872149553399687857146297830364878763673608694434636759773303896159506085472672670558713210501921333058462227444188822916868591893071268581049687884472831284477016171744356197692209391893001975814590875407081409079843847570753624652978353229534727345944100084962186575445080168254068349693213343402194051212518373483099158508416844494586587575956364301894537801311066848168445514196432228108255100694654760323061911666708425773177386359200866161779630276830551354956041869854482996129392080604969770318232847290083683448702192322340; bm := integermul2exp(1, n)-1

10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069375

NULL

NULL

operation := proc (num, n) local q, k; q := num; for k to 2 do q := integerdivq2exp(q, n) end do; q end proc

NULL

operation(num, n)

1083029963437854242395921050992

num1 := 1083029963437854242395921050992

1083029963437854242395921050992

num1_And_result := Bits:-And(num1, bm)

1830994333800291384327304938937691735750004293893503924104067280873348896706437751150658315935255321166852220199930976133533210823991007641683152920140445237629081271967190811426086258505503763155530649996669558866130785263471490070113476827138676322045464116977583554908224267729573167448333358722416

NULL

But if we define num1 before running operation, it is OK.

restart

n := 1000; num := 124345994492475404798327875362902901992795666778727657534420884655177904531686659133645511903099791240872149553399687857146297830364878763673608694434636759773303896159506085472672670558713210501921333058462227444188822916868591893071268581049687884472831284477016171744356197692209391893001975814590875407081409079843847570753624652978353229534727345944100084962186575445080168254068349693213343402194051212518373483099158508416844494586587575956364301894537801311066848168445514196432228108255100694654760323061911666708425773177386359200866161779630276830551354956041869854482996129392080604969770318232847290083683448702192322340; bm := integermul2exp(1, n)-1

10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069375

NULL

NULL

operation := proc (num, n) local q, k; q := num; for k to 2 do q := integerdivq2exp(q, n) end do; q end proc

NULL

num1 := 1083029963437854242395921050992

1083029963437854242395921050992

operation(num, n)

1083029963437854242395921050992

num1_And_result := Bits:-And(num1, bm)

1083029963437854242395921050992

It is also OK if we alter the call to operation so the output is different - argument 1001 instead of n = 1000

restart

n := 1000; num := 124345994492475404798327875362902901992795666778727657534420884655177904531686659133645511903099791240872149553399687857146297830364878763673608694434636759773303896159506085472672670558713210501921333058462227444188822916868591893071268581049687884472831284477016171744356197692209391893001975814590875407081409079843847570753624652978353229534727345944100084962186575445080168254068349693213343402194051212518373483099158508416844494586587575956364301894537801311066848168445514196432228108255100694654760323061911666708425773177386359200866161779630276830551354956041869854482996129392080604969770318232847290083683448702192322340; bm := integermul2exp(1, n)-1

10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069375

NULL

NULL

operation := proc (num, n) local q, k; q := num; for k to 2 do q := integerdivq2exp(q, n) end do; q end proc

NULL

operation(num, 1001)

270757490859463560598980262748

num1 := 1083029963437854242395921050992

1083029963437854242395921050992

num1_And_result := Bits:-And(num1, bm)

1083029963437854242395921050992

NULL

Download Bits_bug2.mw

There are instructions for migrating to Maple Flow (not Maple) and downloading the Migration Assistant at https://www.maplesoft.com/products/mapleflow/migrating-to-maple-flow/

(I don't use Maple Flow and don't have any experience with this.)

@Alfred_F I like to distinguish polynomial systems from more complicated nonlinear systems, since Maple is very good at dealing with polynomials systems (including with inequalities). 

Your expand(dio1) didn't work because you entered the multiplcations in dio1 as "." (matrix multiplication) rather than "*". If you change those then expand(dio1) works as expected. Now for the harder bit...

@Blanc In the GroupTheory package you can set up the finite field with GeneralLinearGroup(1,53), but the elements are permutations, so not so easy to work with. But outside of the GroupTheory package you can find the primitive elements with the GF commands.

restart;

Set up the finite field.

F := GF(53, 1);

_m2143189235968

If we want to represent the elements by integers we need to use the ConvertIn, ConvertOut mechanism. For example

2*31 mod 53;

9

two := F:-ConvertIn(2);
thirty_one := F:-ConvertIn(31);

modp1(ConvertIn(2, T), 53)

modp1(ConvertIn(31, T), 53)

Shorthand way

use F in
two*thirty_one
end use;

modp1(ConvertIn(9, T), 53)

Longer way

F:-`*`(two, thirty_one);
F:-ConvertOut(%);

modp1(ConvertIn(9, T), 53)

9

We can find a primitive element at random and check its multiplicative order is 52

F:-PrimitiveElement();
F:-order(%);

modp1(ConvertIn(21, T), 53)

52

To find all the primitive elements - there are 24 of them

[seq(F:-ConvertIn(i), i = 1..52)]:
map(F:-ConvertOut, select(F:-isPrimitiveElement, %));
nops(%);

[2, 3, 5, 8, 12, 14, 18, 19, 20, 21, 22, 26, 27, 31, 32, 33, 34, 35, 39, 41, 45, 48, 50, 51]

24

 

Download Field.mw

%0 in the message string in userinfo would give the comma

restart;

showargs:=proc()
userinfo(2,procname,"1. arguments: ",_passed);
userinfo(2,procname,"2. arguments: %0",_passed);
NULL
end proc;

proc () userinfo(2, procname, "1. arguments: ", args); userinfo(2, procname, "2. arguments: %0", args); NULL end proc

infolevel[showargs]:=2;

2

showargs(y(x),sin(y));

showargs: 1. arguments:  y(x) sin(y)

showargs: 2. arguments: y(x), sin(y)

NULL

Download userinfo.mw

@Blanc Is this what you want?

restart

with(GroupTheory)

Define group operation and inverse for additive group mod 53.

n := 53

53

Z := module() export `.`, `/`;
`.`:=(a,b)->a+b mod n; # multiplication rule
`/`:=a->-a mod n;      # inverse of a
end module;

_m2104944203328

Use 1 to generate the group

G := CustomGroup([1], Z); GroupOrder(G)

_m2104873192640

53

els := [Elements(G)[]]

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52]

As expected the orders of all elements except the identity are equal to the group order. Therefore they can all generate the group

map(ElementOrder, els, G)

[1, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53]

We can check by seeing if we can generate the same group from one of these elements

G2 := CustomGroup([23], Z); Elements(G2)

_m2104979438784

{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}

Some group tests etc are easier if we have a permutation group. Convert it to a permutation group

PG := PermutationGroup(G); g := GroupOrder(PG); IsCyclic(PG)

_m2104894529568

53

true

Find the elements that have ElementOrder equal to the group order

gens, notgens := selectremove(proc (i) options operator, arrow; ElementOrder(i, PG) = g end proc, [Elements(PG)[]])

The identity is not a generator; the other 52 are.

notgens; nops(gens)

[_m2104893251488]

52

We could check by generating the group with an element and see if we get the same group

el27 := Elements(PG)[28]

_m2104972448896

PG2 := Group({el27})

_m2104815721152

evalb(Elements(PG) = Elements(PG2))

true

NULL

Download CyclicGp.mw

@nm Since you were originally interested in the integral, why not just

seq(evalf(Int(sqrt(1+sin(x)^2),x=0..phi)),phi=-3..3,0.5);

which gives the same as MMA. But if you really want to go from the EllipticE, then

restart;

[seq(evalf(Int(sqrt(1+sin(x)^2),x=0..phi)),phi=-3..3,0.5)];

[-3.678135309, -3.140058363, -2.507982114, -1.810019561, -1.123887723, -.5191743566, 0., .5191743566, 1.123887723, 1.810019561, 2.507982114, 3.140058363, 3.678135309]

q:=[seq(int(sqrt(1+sin(x)^2),x=0..phi), phi=-3..3, 1/2)];

[-2^(1/2)*EllipticE((-sin(3)^2+1)^(1/2), (1/2)*2^(1/2))-2^(1/2)*EllipticE((1/2)*2^(1/2)), -2^(1/2)*EllipticE((-sin(5/2)^2+1)^(1/2), (1/2)*2^(1/2))-2^(1/2)*EllipticE((1/2)*2^(1/2)), -2^(1/2)*EllipticE((-sin(2)^2+1)^(1/2), (1/2)*2^(1/2))-2^(1/2)*EllipticE((1/2)*2^(1/2)), -2^(1/2)*EllipticE((1/2)*2^(1/2))+2^(1/2)*EllipticE((1-sin(3/2)^2)^(1/2), (1/2)*2^(1/2)), -2^(1/2)*EllipticE((1/2)*2^(1/2))+2^(1/2)*EllipticE((1-sin(1)^2)^(1/2), (1/2)*2^(1/2)), -2^(1/2)*EllipticE((1/2)*2^(1/2))+2^(1/2)*EllipticE((1-sin(1/2)^2)^(1/2), (1/2)*2^(1/2)), 0, 2^(1/2)*EllipticE((1/2)*2^(1/2))-2^(1/2)*EllipticE((1-sin(1/2)^2)^(1/2), (1/2)*2^(1/2)), 2^(1/2)*EllipticE((1/2)*2^(1/2))-2^(1/2)*EllipticE((1-sin(1)^2)^(1/2), (1/2)*2^(1/2)), 2^(1/2)*EllipticE((1/2)*2^(1/2))-2^(1/2)*EllipticE((1-sin(3/2)^2)^(1/2), (1/2)*2^(1/2)), 2^(1/2)*EllipticE((-sin(2)^2+1)^(1/2), (1/2)*2^(1/2))+2^(1/2)*EllipticE((1/2)*2^(1/2)), 2^(1/2)*EllipticE((1/2)*2^(1/2))+2^(1/2)*EllipticE((-sin(5/2)^2+1)^(1/2), (1/2)*2^(1/2)), 2^(1/2)*EllipticE((1/2)*2^(1/2))+2^(1/2)*EllipticE((-sin(3)^2+1)^(1/2), (1/2)*2^(1/2))]

evalf(q);

[-3.678135308, -3.140058362, -2.507982114, -1.810019561, -1.123887723, -.519174356, 0., .519174356, 1.123887723, 1.810019561, 2.507982114, 3.140058362, 3.678135308]

q:=signum(phi)*(sqrt(2)*EllipticE(sqrt(2)/2) + sqrt(2)*EllipticE(sqrt(-sin(3)^2 + 1), sqrt(2)/2));

signum(phi)*(2^(1/2)*EllipticE((1/2)*2^(1/2))+2^(1/2)*EllipticE((-sin(3)^2+1)^(1/2), (1/2)*2^(1/2)))

[seq(evalf(q),phi=-3..3, 0.5)];

[-3.678135308, -3.678135308, -3.678135308, -3.678135308, -3.678135308, -3.678135308, 0., 3.678135308, 3.678135308, 3.678135308, 3.678135308, 3.678135308, 3.678135308]

NULL

Download EllipticE.mw

@Blanc What calculations do you want to do with them? You can set up these as a custom Group, but if you just want to calculate with them then just using the mod operator is simpler and already built in, e.g. 41 + 27 mod 53. Are you only interested in mod a prime?

@nm You are right - there are different definitions. 

restart;

EllipticE(phi, k) is given by DLMF 19.2.5 as int(sqrt(1-k^2*sin(x)^2), x = 0 .. phi) = int(sqrt(-k^2*t^2+1)/sqrt(-t^2+1), t = 0 .. sin(phi))but they point out that A&S used the upper limit in the second integral as z. Maple uses this second convention. Now Mathematica uses this second convention but takes the second argument m to be what Maple calls k^2. So when Maple produces second argument I, that is equivalent to MMA's second argument -1. So for the integral in question we expect EllipticE(sin(x),I)

II:=simplify(int(sqrt(1+sin(x)^2),x));
simplify(%, symbolic);

csgn(cos(x))*EllipticE(sin(x), I)

EllipticE(sin(x), I)

which suggests we need some appropriate assumptions to get the simpler result. The following works

simplify(II) assuming cos(x)>1;

EllipticE(sin(x), I)

int(sqrt(1+sin(x)^2),x=0..phi,AllSolutions);

piecewise(0 < phi, 2*EllipticE((1/2)*sqrt(2))*sqrt(2)*ceil(-(-2*phi+Pi)/(4*Pi))+2*EllipticE((1/2)*sqrt(2))*sqrt(2)*ceil(-(-2*phi+3*Pi)/(4*Pi))+piecewise((-(-2*phi+Pi)/(2*Pi))::integer, EllipticE((1/2)*sqrt(2))*sqrt(2), sqrt(-cos(phi)^2+2)*cos(phi)*EllipticE(sin(phi), I)/sqrt(-sin(phi)^4+1)), phi <= 0, 2*EllipticE((1/2)*sqrt(2))*sqrt(2)*floor(-(-2*phi+Pi)/(4*Pi))+2*EllipticE((1/2)*sqrt(2))*sqrt(2)*floor(-(-2*phi+3*Pi)/(4*Pi))+piecewise((-(-2*phi+Pi)/(2*Pi))::integer, -EllipticE((1/2)*sqrt(2))*sqrt(2), sqrt(-cos(phi)^2+2)*cos(phi)*EllipticE(sin(phi), I)/sqrt(-sin(phi)^4+1))+4*EllipticE((1/2)*sqrt(2))*sqrt(2))

Download EllipticE.mw

@nm I suppose there could be different definitions.

Please define what you mean by primitive element.

1 2 3 4 5 6 7 Last Page 1 of 95