Arthur75

68 Reputation

2 Badges

18 years, 47 days

MaplePrimes Activity


These are answers submitted by Arthur75

Thanks a lot for your hints, will try all that, but up to now I was always in document mode, so will have to go into worksheet mode right ?
sorry the image didn't go through the functions are : Db := proc (n) options operator, arrow; n*C^2/C(C+n*e*h) end proc Dcd := proc (n) options operator, arrow; n*(C(C+n*e*h)+C*n*e*h)/(C+n*e*h)^2 end proc Dt := proc (n) options operator, arrow; 4*n*C^2/(2*C+n*e*h)^2 end proc
I cannot see will's reply, a problem with the forum ?
Sorry I'm not sure I understood In the worksheet, Maple provides an obviously wrong polynom for D5 and as well a wrong result, -770, whereas it should be 715 I must have malformed something in the worksheet but did it severall times !! And somebody on another forum did it this way and got the same result : > D1 := proc (p) options operator, arrow; 1 end proc; > D2 := proc (p) options operator, arrow; p-1 end proc; > D3 := proc (p) options operator, arrow; sum(D2(p-i), i = 1 .. p-2) end proc; > factor(D3(p)); > D4 := proc (p) options operator, arrow; sum(D3(p-i), i = 1 .. p-3) end proc; > factor(D4(p)); > D5 := proc (p) options operator, arrow; sum(D4(p-i), i = 1 .. p-4) end proc; > factor(D5(p)); > D5(14); D1 := p -> 1 D2 := p -> p - 1 p - 2 ----- \ D3 := p -> ) D2(p - i) / ----- i = 1 (p - 1) (p - 2) --------------- 2 p - 3 ----- \ D4 := p -> ) D3(p - i) / ----- i = 1 (p - 1) (p - 2) (p - 3) ----------------------- 6 p - 4 ----- \ D5 := p -> ) D4(p - i) / ----- i = 1 (p - 2) (p - 3) (p - 4) (p - 7) - ------------------------------- 12 -770 ??
Martin, Thanks a lot for the advise, I updated the message, didn't seem to completely work though, plus the indentation is lost (and it is part of Python's syntax ...) Anyway the question is more on the initial worksheet than this code, as these functions should all be positive anyway !
The Python code didn't appear properly above, should be : def D1(p): return 1 def D2(p): if p < 2: print "D2 error" , p else: return p-1 def D3(p): r=0 if p < 3: print "D3 error" , p else : i=1 while i < = p-2: r+=D2(p-i) i+=1 return r def D4(p): r=0 if p < 4: print "D4 error" , p else : i=1 while i < = p-3: r+=D3(p-i) i+=1 return r def D5(p): r=0 if p < 5: print "D5 error" , p else : i=1 while i < = p-4: r+=D4(p-i) i+=1 return r Trying Marvin's advise, partially working except for the indentation which is key in Python ! (part of the syntax)
of course read P(n) = (2*n^3 + 3*n^2 + n)/6 for the desired format
Page 1 of 1