Ronan

1022 Reputation

14 Badges

13 years, 158 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are replies submitted by Ronan

@Anthrazit This gives a True answer.  This post should really be converted to a question.

if is(op(1, b) < op(1, a)) then
    "True";
else
    "False";
end if

Edit:-
I purposely kept in "is" because it forces evaluation.

if 1 < sqrt(2) then
    "True";
else
    "False";
end if;
Error, cannot determine if this expression is true or false: 1 < 2^(1/2)
if is(1 < sqrt(2)) then
    "True";
else
    "False";
end if;

You can see the problem  by looking at op(A), it has two parts when A is non  zero i.e. value,unit but only one part when A is zero i.e. value.

Try if is(a<b) then "True" else ""False" end if

@acer  Just out of interest. Are there other situations outside of trig. where solve misses solutions? I mean towards relatively simple type equations like what is presented above. I realise that might be hard to define.

@acer  Thank you. Nice to read the history and orign of such things.

@tomleslie Am using this version. Thank you.

@vv     @tomleslie explained the cause of my problem well in the first reply. I have since converted the formula.

@tomleslie  Thank you. I understand now. Had never read the details on || or cat. Also checking over replies to my series of questions this year some of the answers have become clearer. The m's formula is extendible. So I just could build it around the size of the list L which I would probably call M. So for example  (1 + m2 + 2*m3 + 3*m4 + 4*m5 + 5*m6 + 6*m7)!  would become (1+add(i * M[i], i=1..nops(M)))! , assuming my typing is correct here.

@acer I should have taken more care. Basicially I was looking for 

 5*c^3+ 21*c^2*d + 28*c*d^2 + 12*d^3 

as the 3rd degree form. I was able to get things working properly overall. 

I have combined you answer with  the answer to a previous question I asked  https://www.mapleprimes.com/questions/232082-Is-It-Possible-To-Addsum-By-Mapping#comment278942 

Download 25_Polynomial_General_Expansion.mw

@acer Yes all the table entries are copy and pasted from other equations. I was trying to make the document look similar to 

what was being done in Scientific Workplace. Basicially I am formatting the documents to print them as I find it easier to flick through printed pages than  open half a dozen Maple documents or videos to find something.

A link to one of the videos. It about developing a power series type solution to polynomials. Solving Polynomial Equations 2: The Quadratic case | Exploring Research Level Maths | Wild Egg Maths | N J Wildberger on Patreon

You might find it interesting.

@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.

First 9 10 11 12 13 14 15 Last Page 11 of 24