R.<x> = QQ[]
x=(r-2)^3 * ((r^2)+9)
show (x.roots())
x,c1,c2,c3,c4,c5 = var('x,c1,c2,c3,c4,c5')
yc = function ('y',x)
yc(x) = c1*exp(2*x) + (c2*x)*exp(2*x) + (c3*(x^2))*exp(2*x) + c4*cos(x) + c5*sin(x)
show (yc)
f = function('y',x)
f(x) = ((x^2)*exp(x)) + (sin(3*x))
A,B,C,D,E,F,G = var('A,B,C,D,E,F,G')
yp= function ('y',x)
yp(x) = exp(x)*(A*(x^2) + B*(x) + C) + D*x*sin(3*x) + E*x*cos(3*x) + F*(x^2)*sin(3*x) + G*(x^2)*cos(3*x)
show(yp(x))
j=((r-2)^3)*((r^2)+9)
show(j.expand())
k= function ('k',x)
k= diff(yp,x,5) - 6*diff(yp,x,4) + 21*diff(yp,x,3) - 62*diff(yp,x,2) + 108*diff(yp,x,1) -72*yp
solve([k(0)==f(0), k(1)==f(1), k(-1)==f(-1), k(2)==f(2), k(-2)==f(-2), k(pi)==f(pi), k(3)==f(3)],A,B,C,D,E,F,G)
yp(x)= exp(x)*((-1/10)*(x^2) + (-14/25)*(x) + (-267/250)) + (-3/4394)*x*sin(3*x) + (-23/6591)*x*cos(3*x) + 0*(x^2)*sin(3*x) + 0*(x^2)*cos(3*x)
show(yp)
y= function('y',x)
y(x)= yc(x) + yp(x)
show(y)
solve([y(0)==1,diff(y,x)(0)==1,diff(y,x,2)(0)==1,diff(y,x,3)(0)==1, diff(y,x,4)(0)==1],c1,c2,c3,c4,c5)
y(x)=(( (198089/633750)*(x^2)*exp(2*x) + (-8973996/6865625)*x*exp(2*x) - (23/6591)*x*cos(3*x) + (67439/1218750)*cos(x) + (1226468/609375)*exp(2*x) -(1/12950)*(1295*(x^2) + 7252*x + 13350)*exp(x)) - (3/4394)*x*sin(3*x) + (-105727/1218750)*sin(x))
show(y)
Error in lines 2-2
Traceback (most recent call last):
File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 968, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "sage/rings/integer.pyx", line 1679, in sage.rings.integer.Integer.__sub__ (/projects/sage/sage-7.3/src/build/cythonized/sage/rings/integer.c:11451)
return coercion_model.bin_op(left, right, operator.sub)
File "sage/structure/coerce.pyx", line 1091, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/projects/sage/sage-7.3/src/build/cythonized/sage/structure/coerce.c:9974)
raise TypeError(arith_error_message(x,y,op))
TypeError: unsupported operand parent(s) for '-': '<type 'function'>' and 'Integer Ring'