Displaying 2 results from an estimated 2 matches for "rtaylorval".
2009 Dec 01
1
Adding and Multiplying two Unevaluated Expressions
HI,
As I'm trying to compute Taylor series, I'm having problems in adding and multiplying unevaluated expressions. I searched for a solution but found none.
my Taylor function works fine for evaluating functions as you can see here:
rTaylorVal=function(exp,x0,dx,n) {
ls=list(x=x0)
newexp=eval(exp,ls)
exp0=exp
for (i in 1:n){
exp0=D(exp0,"x")
newexp=newexp+eval(exp0,ls)/factorial(i)*dx^i
}
return(newexp)
}
Where exp is an expression like exp=expression(x^2*sin(x)), x0 is the startvalue, dx the difference between startvalu...
2009 Dec 02
0
[Fwd: Re: Adding and Multiplying two Unevaluated Expressions]
...rying to compute Taylor series, I'm having problems in adding
>> and multiplying unevaluated expressions. I searched for a solution
>> but found none.
>>
>> my Taylor function works fine for evaluating functions as you can see
>> here:
>>
>>
>> rTaylorVal=function(exp,x0,dx,n) {
>>
>> ls=list(x=x0)
>>
>> newexp=eval(exp,ls)
>>
>> exp0=exp
>>
>> for (i in 1:n){
>> exp0=D(exp0,"x")
>> newexp=newexp+eval(exp0,ls)/factorial(i)*dx^i
>> }
>>
>> return(newexp)
>>...