Ronan

1107 Reputation

14 Badges

12 years, 100 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are questions asked by Ronan

I have this procedure to perform a Boole-Mobius Transform. I took me quite a while to figure out. Whereas it works, I wonder how it should be done efficiently? The document is also attached which shows the steps I went through to derive the procedure. I can't get the document to display.

BooleMobiusTransform := proc(V) 
local n, im, istep, jm, h, istart, i, j, k; n := ilog2(numelems(V)); im := 2^n/2; istep := im; jm := 1; h := 2^n; 
for k to n do
 istart := 1; 
for j to jm do 
for i from istart to im - 1 + istart do 
V(istep + i) := (V[istep + i] + V[i]) mod 2;
 end do;
 istart := istart + h; 
end do;
 im := 1/2*im; istep := 1/2*istep; jm := 2*jm; h := 1/2*h; 
end do; 
return V; 
end proc

Boole-Mobius_Transform.mw

I am experimenting with using units especially for when there are awkard conversion factors. 

The document is for motor gearbox torques inertia ration and frequency.

I have documented my specific questions in the worksheet.

I am interested is see different ways of setting this up. Like I would rather setup the formulas at the start, then supply figures.


 

restart

``

with(Units[Natural])

UseSystem('SI')

UseSystem(SI)

(1)

Can I set the units for mass, accel, etc. so I don't have to re enter the default units if I change the figures later?

``

Mass := 3000*'kg'

3000*Units:-Unit(kg)

(2)

Accel := 1.5*'m'/'s'^2

1.5*Units:-Unit(m/s^2)

(3)

Rat := 5

5

(4)

``

Radius := (1/2)*(0.8282e-1-0.6e-2)*'m'

0.3841000000e-1*Units:-Unit(m)

(5)

Torque := Mass*Accel*Radius

172.8450000*Units:-Unit(J)

(6)

````

MotorTorque := Torque/Rat

34.56900000*Units:-Unit(J)

(7)

Jload := Mass*Radius^2

4.425984300*Units:-Unit(kg*m^2)

(8)

Jmtr := 1.42*10^(-2)*'kg'*'m'^2

0.1420000000e-1*Units:-Unit(kg*m^2)

(9)

Parse:-ConvertTo1D, "first argument to _Inert_ASSIGN must be assignable"

12.46756141

(10)

stiff := convert(48, 'units', 'N'*'m(radius)'/'arcmin', 'N'*'m(rarius)'/'rad', 'symbolic')

518400/Pi

(11)

/rad

518400/Pi

(12)

"(->)"

0.16501e6

(13)

``

Freq := sqrt(stiff/Jload)/(2*Pi)/s   i.e. Hertz

30.73072153*Units:-Unit(1/(kg^(1/2)*m))

(14)

stiff := 4567

4567

(15)

Freq

30.73072153*Units:-Unit(1/(kg^(1/2)*m))

(16)

``


 

Download Units_questions.mw

I am trying to get this to work

{seq(isolve({a = k, irem(a*b, 10000) = 2391}), k = 1 .. 9999)}

but am not getting any answer. One solution is irem(297*9503, 10000).

I have noticed a few times now with Maple 2019. It looses kernel connection when it is sitting there idly. This time I observed it. Had saved a document after an intensive calculation. The memory used was about 30Gig. shortly after saving the cpu fan was running hard. I checked task manager and cpu was cycling to 100%, it was mserever. Then the memory usage droped to about 6gig and message as shown. During this time Maple screen down in the LH corner displayed "Ready", so it didn't think it was doing anything.
 

My code below works but I an looking to speed it up to apply to large arrays. I have large integers and I want to store the exponent and first and last few digits.

nelems := 10;  ~ takes about 50mins when n=100,000,000
n := 374894756873546859847556;
op(n);
A := Array(1 .. 4, 1 .. nelems);
length(n);
st := time();
for i to nelems do
    A[1, i] := i^10*n;
    A[2, i] := length(A[1, i]) - 1;
    b := convert(A[1, i], string);
    A[3, i] := parse(b[1 .. 3]);
    A[4, i] := parse(b[-3 .. -1]);
end do;
time() - st;
A;
A[1, -2];
A[2, -2];
A[3, -2];
A[4, -2];

 

First 13 14 15 16 17 18 19 Last Page 15 of 29