Ronan

1207 Reputation

14 Badges

12 years, 214 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are replies submitted by Ronan

@acer All the answers on this are very helpful. II missed that part of the help. I use the the help pages as I like to have something to show when I ask a question. Sometimes rushing I mass important details as  in "%".

@acer Thank you. That works well. But I dont understand the syntax. I didnt realise % made operations inert.  I haven't seen that in the help or at least I have found that.

InertForm:-Display~(M,inert=false):  I tried it with inert=true that made no difference and I left out inert altogether and that made no difference either. What am I missing here?

It would be nice to know how to get to display 2! 2!.  I couldn't get  `%*` to work.   

 

@Carl Love Thank you. When I first asked the question I hadn't bothered about the sign of the terms. which for all cases is (-1)^(m3+1). I got it to work abe modifying the itterator expression. It just means that P=2 doesnt work but easly work around is  coeff(%,c3,0) for P=3

restart;

Iterator:-CartesianProduct([1,1]): #Force compilation


P:= 2..3: #suffixes of m and c variables
N:= [$0..20]: #evaluation values of m variables

B:= subs(
    {_C= [$P], _V= [c||P]}, 
    proc(M)
    local r:= add(M*~_C), s:= 1+r, t:= s-add(M);
        r!*c0^t*mul(_V^~M)/t!/mul(M!~)/c1^s
    end proc
):
CodeTools:-Usage(
    seq[reduce= `+`]((-1)^(v[2]+1)*B(v), v= Iterator:-CartesianProduct(N$(rhs(P)-1)))
)

@Carl Love  to answer both replies here. Yes I had wondered about the For loop when I red your code yesterday but didn't get to try it then.

On the Iterator:-CartesianProduct there is quite a time delay when it is first run after a restart. Then it is really fast. Would adding this into the start up code region (not that I have ever used it) get around this? 


@tomleslie I seperated out the code onto different lines to help me understand what is happening.

The Iterator:-Cartesian product then gave an error. So I had to change $=0..4 to $ 0..4  Why?

As A an B use the arrow operator, why add(A~...   instead of  add(A(m)~......  which actually gives incorrect output.

I see the Iterator:-CartesianProduct is very fast. I gather  this auto compiles which causes some bit of a delay 1st time. Question here. Coud auto compile type routines be added to start up code so restart doesn't affect this?

  restart;
 

 A:= m-> (2*m[1] + 3*m[2])!*c0^(1 + m[1] + 2*m[2])*c2^m[1]*c3^m[2]
          /
          ((1 + m[1] + 2*m[2])!*m[1]!*m[2]!*c1^(2*m[1] + 3*m[2] + 1));
  

proc (m) options operator, arrow; factorial(2*m[1]+3*m[2])*c0^(1+m[1]+2*m[2])*c2^m[1]*c3^m[2]/(factorial(1+m[1]+2*m[2])*factorial(m[1])*factorial(m[2])*c1^(2*m[1]+3*m[2]+1)) end proc

(1)

add(`~`[A]([seq(v[], v = Iterator:-CartesianProduct(`$`([`$`(0 .. 4)], 2)))]))

c0^2*c2/c1^3+c0/c1+c0^3*c3/c1^4+330*c0^7*c2^4*c3/c1^12+84*c0^6*c2^3*c3/c1^10+21*c0^5*c2^2*c3/c1^8+5*c0^4*c2*c3/c1^6+28*c0^6*c2*c3^2/c1^9+180*c0^7*c2^2*c3^2/c1^11+990*c0^8*c2^3*c3^2/c1^13+5005*c0^9*c2^4*c3^2/c1^15+61880*c0^11*c2^4*c3^3/c1^18+10010*c0^10*c2^3*c3^3/c1^16+1430*c0^9*c2^2*c3^3/c1^14+165*c0^8*c2*c3^3/c1^12+1001*c0^10*c2*c3^4/c1^15+10920*c0^11*c2^2*c3^4/c1^17+92820*c0^12*c2^3*c3^4/c1^19+678300*c0^13*c2^4*c3^4/c1^21+14*c0^5*c2^4/c1^9+2*c0^3*c2^2/c1^5+3*c0^5*c3^2/c1^7+12*c0^7*c3^3/c1^10+55*c0^9*c3^4/c1^13+5*c0^4*c2^3/c1^7

(2)

B := proc (m) options operator, arrow; factorial(2*m[1]+3*m[2]+4*m[3])*c0^(1+m[1]+2*m[2]+3*m[3])*c2^m[1]*c3^m[2]*c4^m[3]/(factorial(1+m[1]+2*m[2]+3*m[3])*factorial(m[1])*factorial(m[2])*factorial(m[3])*c1^(2*m[1]+3*m[2]+4*m[3]+1)) end proc

proc (m) options operator, arrow; factorial(2*m[1]+3*m[2]+4*m[3])*c0^(1+m[1]+2*m[2]+3*m[3])*c2^m[1]*c3^m[2]*c4^m[3]/(factorial(1+m[1]+2*m[2]+3*m[3])*factorial(m[1])*factorial(m[2])*factorial(m[3])*c1^(2*m[1]+3*m[2]+4*m[3]+1)) end proc

(3)

``

add(`~`[B]([seq(v[], v = Iterator:-CartesianProduct(`$`([`$`(0 .. 4)], 3)))]))

140*c0^13*c4^4/c1^17+4*c0^7*c4^2/c1^9+22*c0^10*c4^3/c1^13+c0^2*c2/c1^3+c0/c1+c0^3*c3/c1^4+116280*c0^14*c2*c3^3*c4^2/c1^20+1119195*c0^16*c2*c3^4*c4^2/c1^23+18170460*c0^17*c2^2*c3^4*c4^2/c1^25+218718500*c0^18*c2^3*c3^4*c4^2/c1^27+2175673500*c0^19*c2^4*c3^4*c4^2/c1^29+67737852000*c0^22*c2^4*c3^4*c4^3/c1^33+6009003000*c0^21*c2^3*c3^4*c4^3/c1^31+435134700*c0^20*c2^2*c3^4*c4^3/c1^29+23023000*c0^19*c2*c3^4*c4^3/c1^27+2018940*c0^17*c2*c3^3*c4^3/c1^24+33649000*c0^18*c2^2*c3^3*c4^3/c1^26+414414000*c0^19*c2^3*c3^3*c4^3/c1^28+4206302100*c0^20*c2^4*c3^3*c4^3/c1^30+218718500*c0^18*c2^4*c3^2*c4^3/c1^27+24227280*c0^17*c2^3*c3^2*c4^3/c1^25+2238390*c0^16*c2^2*c3^2*c4^3/c1^23+155040*c0^15*c2*c3^2*c4^3/c1^21+9520*c0^13*c2*c3*c4^3/c1^18+116280*c0^14*c2^2*c3*c4^3/c1^20+1085280*c0^15*c2^3*c3*c4^3/c1^22+8580495*c0^16*c2^4*c3*c4^3/c1^24+155405250*c0^19*c2^4*c3*c4^4/c1^28+16824500*c0^18*c2^3*c3*c4^4/c1^26+1514205*c0^17*c2^2*c3*c4^4/c1^24+101745*c0^16*c2*c3*c4^4/c1^22+2018940*c0^18*c2*c3^2*c4^4/c1^25+34534500*c0^19*c2^2*c3^2*c4^4/c1^27+435134700*c0^20*c2^3*c3^2*c4^4/c1^29+4506752250*c0^21*c2^4*c3^2*c4^4/c1^31+97189092000*c0^23*c2^4*c3^3*c4^4/c1^34+8467231500*c0^22*c2^3*c3^3*c4^4/c1^32+600900300*c0^21*c2^2*c3^3*c4^4/c1^30+31081050*c0^20*c2*c3^3*c4^4/c1^28+409704750*c0^22*c2*c3^4*c4^4/c1^31+8835372000*c0^23*c2^2*c3^4*c4^4/c1^33+137684547000*c0^24*c2^3*c3^4*c4^4/c1^35+1734825292200*c0^25*c2^4*c3^4*c4^4/c1^37+72*c0^7*c2*c3*c4/c1^10+495*c0^8*c2^2*c3*c4/c1^12+2860*c0^9*c2^3*c3*c4/c1^14+15015*c0^10*c2^4*c3*c4/c1^16+406980*c0^13*c2^4*c3*c4^2/c1^20+61880*c0^12*c2^3*c3*c4^2/c1^18+8190*c0^11*c2^2*c3*c4^2/c1^16+858*c0^10*c2*c3*c4^2/c1^14+10920*c0^12*c2*c3^2*c4^2/c1^17+128520*c0^13*c2^2*c3^2*c4^2/c1^19+1162800*c0^14*c2^3*c3^2*c4^2/c1^21+8953560*c0^15*c2^4*c3^2*c4^2/c1^23+151420500*c0^17*c2^4*c3^3*c4^2/c1^26+17160990*c0^16*c2^3*c3^3*c4^2/c1^24+1627920*c0^15*c2^2*c3^3*c4^2/c1^22+5460*c0^11*c2*c3^3*c4/c1^16+61880*c0^12*c2^2*c3^3*c4/c1^18+542640*c0^13*c2^3*c3^3*c4/c1^20+4069800*c0^14*c2^4*c3^3*c4/c1^22+278460*c0^12*c2^4*c3^2*c4/c1^19+43680*c0^11*c2^3*c3^2*c4/c1^17+6006*c0^10*c2^2*c3^2*c4/c1^15+660*c0^9*c2*c3^2*c4/c1^13+51482970*c0^16*c2^4*c3^4*c4/c1^25+5969040*c0^15*c2^3*c3^4*c4/c1^23+581400*c0^14*c2^2*c3^4*c4/c1^21+42840*c0^13*c2*c3^4*c4/c1^19+c0^4*c4/c1^5+1820*c0^12*c3^4*c4/c1^17+286*c0^10*c3^3*c4/c1^14+45*c0^8*c3^2*c4/c1^11+7*c0^6*c3*c4/c1^8+495*c0^8*c2^4*c4/c1^13+120*c0^7*c2^3*c4/c1^11+28*c0^6*c2^2*c4/c1^9+6*c0^5*c2*c4/c1^7+45*c0^8*c2*c4^2/c1^11+330*c0^9*c2^2*c4^2/c1^13+2002*c0^10*c2^3*c4^2/c1^15+10920*c0^11*c2^4*c4^2/c1^17+55*c0^9*c3*c4^2/c1^12+546*c0^11*c3^2*c4^2/c1^15+4760*c0^13*c3^3*c4^2/c1^18+38760*c0^15*c3^4*c4^2/c1^21+672980*c0^18*c3^4*c4^3/c1^25+67830*c0^16*c3^3*c4^3/c1^22+6120*c0^14*c3^2*c4^3/c1^19+455*c0^12*c3*c4^3/c1^16+193800*c0^14*c2^4*c4^3/c1^21+28560*c0^13*c2^3*c4^3/c1^19+3640*c0^12*c2^2*c4^3/c1^17+364*c0^11*c2*c4^3/c1^15+3060*c0^14*c2*c4^4/c1^19+38760*c0^15*c2^2*c4^4/c1^21+373065*c0^16*c2^3*c4^4/c1^23+3028410*c0^17*c2^4*c4^4/c1^25+3876*c0^15*c3*c4^4/c1^20+65835*c0^17*c3^2*c4^4/c1^23+885500*c0^19*c3^3*c4^4/c1^26+10360350*c0^21*c3^4*c4^4/c1^29+330*c0^7*c2^4*c3/c1^12+84*c0^6*c2^3*c3/c1^10+21*c0^5*c2^2*c3/c1^8+5*c0^4*c2*c3/c1^6+28*c0^6*c2*c3^2/c1^9+180*c0^7*c2^2*c3^2/c1^11+990*c0^8*c2^3*c3^2/c1^13+5005*c0^9*c2^4*c3^2/c1^15+61880*c0^11*c2^4*c3^3/c1^18+10010*c0^10*c2^3*c3^3/c1^16+1430*c0^9*c2^2*c3^3/c1^14+165*c0^8*c2*c3^3/c1^12+1001*c0^10*c2*c3^4/c1^15+10920*c0^11*c2^2*c3^4/c1^17+92820*c0^12*c2^3*c3^4/c1^19+678300*c0^13*c2^4*c3^4/c1^21+14*c0^5*c2^4/c1^9+2*c0^3*c2^2/c1^5+3*c0^5*c3^2/c1^7+12*c0^7*c3^3/c1^10+55*c0^9*c3^4/c1^13+5*c0^4*c2^3/c1^7

(4)

add(`~`[B]([seq(v[], v = Iterator:-CartesianProduct(`$`([`$`(0 .. 25)], 3)))]))

nops(%)

17576

(5)

NULL


 

Download modified_Sums.mw

 

Both are very useful answers.

@dharr Thank you.This may interest you. I was following a series of math videos form N. J. Wildberger on YouTube, on the origins of Boolean Algebra.  It rapidly leads into an efficient  canonical form of Boole's algebra. This is the link to the first in the series .A brief history of logic: Aristotle and deduction | Math Foundations 251 | NJ Wildberger - YouTube

It is great to hear that one's question is of use to another.

@Carl Love My sloppy code didn't help. I knew I should swap jm and h before I first posted.

 im := 1/2*im; istep := 1/2*istep; jm := 2*jm; h := 1/2*h; 

 I then assumed because V1 transformed back to V0 when the transform was applied to it that the code must be correct. Well done to @dharr for catching that.

Also I hadn't checked the n=3 case against the original matrix which would have caught the problem.

@Carl Love Compare the timings

Tonight's

n = 25:
memory used=4.00GiB, alloc change=256.00MiB, cpu time=63.14s, real time=57.23s, gc time=13.16s
V0 = RTABLE(18446746400855522110, (100110111010010011100011010100

  10hellip... 33554400 row vector entries not shown), 

  Vector[row], Handle)
V1 = RTABLE(18446746400855518854, (111000110010101001111000111101

  10hellip... 33554400 row vector entries not shown), 

  Vector[row], Handle)

Previous Nights

n = 25:
memory used=0.50GiB, alloc change=0.50GiB, cpu time=140.00ms, real time=154.00ms, gc time=0ns
V0 = RTABLE(18446746173536082150, (100110111010010011100011010100

  10hellip... 33554400 row vector entries not shown), 

  Vector[row], Handle)
V1 = RTABLE(18446746173536074798, (100110111010010011100011010100

  10hellip... 33554400 row vector entries not shown), 

  Vector[row], Handle)

 

@Carl Love That code is amazing. I had no idea something could be improved so vastly. Thank you for the clarifiaction on the 1D input.

@Carl Love Ok. I'm using Maple 2019.2. Is a different syntax required because 1D still did not like the +=. In the loops you have "to n do" Should I change these to "for i to n do" etc? It getting late here 2am. I will give it another shot tomorrow evening.

LAM_BM_Transform-1D.mw

@dharr That is very fast.

Can a compiled procedure be saved to disk? And then used in apackage?

 

@Carl Love  I tried the code but it does not transform the vector, I could be doing something wrong. I corrected "istart+=h" because was getting an error message about unterminated loop, to "istart:=istart+h". I ran this for n=3 so the vector only has 8 elements.

why do you have to make a copy of the vector inside the procedure? 

LAM:-Copy(2, V, 1..-1, R, 1..nv);

I tried copy and pasting the whole code but would probably only introduce more errors tidying it up.

LAM_BM_Transform.mw

 

 

Hello,

 Nice work. At some point I will have to study up on the Draghilev method. I gather it applies to dynamic systems.

Here is an SG platform I post a few years ago. It only deals with a static version of the reverse kinematics. It would be interesting to see the method applied to it.

https://www.mapleprimes.com/posts/208301-Stewart-Gough-Reverse-Kinematics

 


Hope this helps

restart

``

T := sqrt(6)*sqrt((n-1)*(-15*k^2*n+15*k^2-30*k*n+30*k-15*n+15+sqrt(1920*n*q*sigma^6-1920*q*sigma^6+225*k^4*n^2+5760*Q*n*sigma^3-450*k^4*n+900*k^3*n^2-5760*Q*sigma^3+225*k^4-1800*k^3*n+1350*k^2*n^2+900*k^3-2700*k^2*n+900*k*n^2+1350*k^2-1800*k*n+225*n^2+900*k-450*n+225)))/(12*sigma^2*(n-1)), -sqrt(6)*sqrt((n-1)*(-15*k^2*n+15*k^2-30*k*n+30*k-15*n+15+sqrt(1920*n*q*sigma^6-1920*q*sigma^6+225*k^4*n^2+5760*Q*n*sigma^3-450*k^4*n+900*k^3*n^2-5760*Q*sigma^3+225*k^4-1800*k^3*n+1350*k^2*n^2+900*k^3-2700*k^2*n+900*k*n^2+1350*k^2-1800*k*n+225*n^2+900*k-450*n+225)))/(12*sigma^2*(n-1)), sqrt(-(6*(n-1))*(15*k^2*n-15*k^2+30*k*n+sqrt(1920*n*q*sigma^6-1920*q*sigma^6+225*k^4*n^2+5760*Q*n*sigma^3-450*k^4*n+900*k^3*n^2-5760*Q*sigma^3+225*k^4-1800*k^3*n+1350*k^2*n^2+900*k^3-2700*k^2*n+900*k*n^2+1350*k^2-1800*k*n+225*n^2+900*k-450*n+225)-30*k+15*n-15))/(12*sigma^2*(n-1)), -sqrt(-(6*(n-1))*(15*k^2*n-15*k^2+30*k*n+sqrt(1920*n*q*sigma^6-1920*q*sigma^6+225*k^4*n^2+5760*Q*n*sigma^3-450*k^4*n+900*k^3*n^2-5760*Q*sigma^3+225*k^4-1800*k^3*n+1350*k^2*n^2+900*k^3-2700*k^2*n+900*k*n^2+1350*k^2-1800*k*n+225*n^2+900*k-450*n+225)-30*k+15*n-15))/(12*sigma^2*(n-1))

(1/12)*6^(1/2)*((n-1)*(-15*k^2*n+15*k^2-30*k*n+30*k-15*n+15+(1920*n*q*sigma^6-1920*q*sigma^6+225*k^4*n^2+5760*Q*n*sigma^3-450*k^4*n+900*k^3*n^2-5760*Q*sigma^3+225*k^4-1800*k^3*n+1350*k^2*n^2+900*k^3-2700*k^2*n+900*k*n^2+1350*k^2-1800*k*n+225*n^2+900*k-450*n+225)^(1/2)))^(1/2)/(sigma^2*(n-1)), -(1/12)*6^(1/2)*((n-1)*(-15*k^2*n+15*k^2-30*k*n+30*k-15*n+15+(1920*n*q*sigma^6-1920*q*sigma^6+225*k^4*n^2+5760*Q*n*sigma^3-450*k^4*n+900*k^3*n^2-5760*Q*sigma^3+225*k^4-1800*k^3*n+1350*k^2*n^2+900*k^3-2700*k^2*n+900*k*n^2+1350*k^2-1800*k*n+225*n^2+900*k-450*n+225)^(1/2)))^(1/2)/(sigma^2*(n-1)), (1/12)*(-6*(n-1)*(15*k^2*n-15*k^2+30*k*n+(1920*n*q*sigma^6-1920*q*sigma^6+225*k^4*n^2+5760*Q*n*sigma^3-450*k^4*n+900*k^3*n^2-5760*Q*sigma^3+225*k^4-1800*k^3*n+1350*k^2*n^2+900*k^3-2700*k^2*n+900*k*n^2+1350*k^2-1800*k*n+225*n^2+900*k-450*n+225)^(1/2)-30*k+15*n-15))^(1/2)/(sigma^2*(n-1)), -(1/12)*(-6*(n-1)*(15*k^2*n-15*k^2+30*k*n+(1920*n*q*sigma^6-1920*q*sigma^6+225*k^4*n^2+5760*Q*n*sigma^3-450*k^4*n+900*k^3*n^2-5760*Q*sigma^3+225*k^4-1800*k^3*n+1350*k^2*n^2+900*k^3-2700*k^2*n+900*k*n^2+1350*k^2-1800*k*n+225*n^2+900*k-450*n+225)^(1/2)-30*k+15*n-15))^(1/2)/(sigma^2*(n-1))

(1)

``

solve(T[1], Q)

-(1/3)*q*sigma^3

(2)

``

solve(T[1], q)

-3*Q/sigma^3

(3)

solve(T[1], sigma)

(-3*Q*q^2)^(1/3)/q, -(1/2)*(-3*Q*q^2)^(1/3)/q-((1/2)*I)*3^(1/2)*(-3*Q*q^2)^(1/3)/q, -(1/2)*(-3*Q*q^2)^(1/3)/q+((1/2)*I)*3^(1/2)*(-3*Q*q^2)^(1/3)/q

(4)

solve(T[1], k)

``

solve(T[1], n)*`~nosolution`

``


 

Download MP_Help_C.mw

@AHSAN 

First 15 16 17 18 19 20 21 Last Page 17 of 29