### Re: Probably a No-Brainer

Wait a minute . . I think I got it: on mouseUp put 0 into m repeat 3 --(or any number) get fld "genFctn" put it&"+" after field "explFctn" replace n with m in fld "explFctn" add 1 to m end repeat delete last char of fld "explFctn" end mouseUp Roger > On Dec 27, 2018, at 11:31 AM, Roger Guay via use-livecode > wrote: > > You are so clever, Herman! Yes, the idea is to write it out into a field. > > This is great for the Taylor series, but how would one generalize this so > that we could expand any fctn of x and n in the “genFctn” field into the > “expandedFctn” field > > Sorry to take up so much of your time. > > Thanks, > > Roger > >> On Dec 27, 2018, at 11:02 AM, hh via use-livecode >> wrote: >> >> You don't want to compute it but want to write it out into a field? >> >> on mouseUp >> put taylorsum(4,"x") into fld "OUT" >> end mouseUp >> >> function taylorsum n,x -- n is the degree, x the function argument >> put "1" into s -- or: put x &"^0/0!" into s >> repeat with i=1 to n >> put " + " & x &"^"& i &"/"& i &"!" after s >> end repeat >> return char 1 to -1 of s >> end taylorsum >> >> taylorsum(4,"x") yields --> 1 + x^1/1! + x^2/2! + x^3/3! + x^4/4! >> taylorsum(4,"2") yields --> 1 + 2^1/1! + 2^2/2! + 2^3/3! + 2^4/4! >> >> >> ___ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode

### Re: Probably a No-Brainer

You are so clever, Herman! Yes, the idea is to write it out into a field. This is great for the Taylor series, but how would one generalize this so that we could expand any fctn of x and n in the “genFctn” field into the “expandedFctn” field Sorry to take up so much of your time. Thanks, Roger > On Dec 27, 2018, at 11:02 AM, hh via use-livecode > wrote: > > You don't want to compute it but want to write it out into a field? > > on mouseUp > put taylorsum(4,"x") into fld "OUT" > end mouseUp > > function taylorsum n,x -- n is the degree, x the function argument > put "1" into s -- or: put x &"^0/0!" into s > repeat with i=1 to n >put " + " & x &"^"& i &"/"& i &"!" after s > end repeat > return char 1 to -1 of s > end taylorsum > > taylorsum(4,"x") yields --> 1 + x^1/1! + x^2/2! + x^3/3! + x^4/4! > taylorsum(4,"2") yields --> 1 + 2^1/1! + 2^2/2! + 2^3/3! + 2^4/4! > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode

### Re: Probably a No-Brainer

You don't want to compute it but want to write it out into a field? on mouseUp put taylorsum(4,"x") into fld "OUT" end mouseUp function taylorsum n,x -- n is the degree, x the function argument put "1" into s -- or: put x &"^0/0!" into s repeat with i=1 to n put " + " & x &"^"& i &"/"& i &"!" after s end repeat return char 1 to -1 of s end taylorsum taylorsum(4,"x") yields --> 1 + x^1/1! + x^2/2! + x^3/3! + x^4/4! taylorsum(4,"2") yields --> 1 + 2^1/1! + 2^2/2! + 2^3/3! + 2^4/4! ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode

### Re: Probably a No-Brainer

Thanks to Herman and Håkan but I haven’t got it yet. Consider the sum from n=0 to 2 of x^n/n!. What I want to do is expand this into the series x^0/0! + x^1/1! + x^2/2! etc. I can’t seem to wrap my head around this one!! Thanks very much, Roger > On Dec 27, 2018, at 8:25 AM, ha...@exformedia.se wrote: > > replace "x^n" with "x^" & n in field "formula" > > might do the trick… > > :-Håkan > On 27 Dec 2018, 04:34 +0100, Roger Guay via use-livecode > , wrote: >> As an example, I want to replace the contents of a field that contains x^n >> with x^1 or x^2 or x^3 as n= 1 or 2 or 3 etc. >> But I can’t seem to find find a script that works. Help please?? >> >> Roger >> ___ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode

### Re: Probably a No-Brainer

replace "x^n" with "x^" & n in field "formula" might do the trick… :-Håkan On 27 Dec 2018, 04:34 +0100, Roger Guay via use-livecode , wrote: > As an example, I want to replace the contents of a field that contains x^n > with x^1 or x^2 or x^3 as n= 1 or 2 or 3 etc. > But I can’t seem to find find a script that works. Help please?? > > Roger > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode

### Re: Probably a No-Brainer

> Roger wrote: > I want to replace the contents of a field that contains x^n > with x^1 or x^2 or x^3 as n= 1 or 2 or 3 etc. You could try to write in the file "x^[[n]] + x^[[n+1]]" and then script put 2 into n put merge(fld 1) into fld 1 --> yields "x^2 + x^3" ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode

### Probably a No-Brainer

As an example, I want to replace the contents of a field that contains x^n with x^1 or x^2 or x^3 as n= 1 or 2 or 3 etc. But I can’t seem to find find a script that works. Help please?? Roger ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode