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
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,
Roge
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 &"/"&
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...@exformedi
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 fi
> 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"
___
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
P