Bill Allombert on Sun, 20 Nov 2022 15:22:06 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: symbol manipulation |
On Sun, Nov 20, 2022 at 01:45:26PM +0100, Ruud H.G. van Tol wrote: > > I'm looking for a simpler way to investigate how a formula evolves, for > formulas with inner loops. > > My test-formula: > A071521(n)= my(t=1/3; sum(k=0, logint(n, 3), t*=3; logint(n\t, 2)+1) > > { > f(n)=my( t= 1/3 > , add_(v1,v2)= Str("((",v1,")+(",v2,"))") > , mul_(v1,v2)= Str("((",v1,")*(",v2,"))") > , idiv_(v1,v2)= Str("((",v1,")\\(",v2,"))") > , logint_(v,b)= Str("logint(",v,",",b,")") > , sum_(f,t,s)= Str("sum(k_=",f,",",t,",",s,")") > , a_(n)= sum_( > k=0, logint_(n,3), add_(logint_(idiv_(n, (mul_(t,3))), 2), 1)) > ); > a_(n) > } > > my(f_); eval(Str("f_()=",f(2))); f_ > %3 = ()->my(f_);sum(k_=0,logint(5,3),((logint(((5)\(((1/3)*(3)))),2))+(1))) This does not seem quite right, since this does not depend on k. > The ultimately desired return value is "logint(x,2)". > How feasible/doable is that? It is unclear what purpose this would serve you. One trick is to convert functional values to variables this way: ? eval(Str("'logint_",x,"_",2)) %3 = logint_x_2 that you can then add and multiply as needed. Cheers, Bill