# how to write a series over one of the variables??

2 views (last 30 days)
Omidreza Ghafarinejad on 15 May 2015
Commented: Walter Roberson on 16 May 2015
hi friends. I am writing a code to solve a mathematics problem. I have an expression which includes several variables. I should write the series of this expression over one of the variables and then assign variables using subs function. My code is here:
syms x y L n real
assume(n,'integer');
f=1000; h=0.5;
beta=n*pi/L;
J=h^3/12;
Q=dirac(x)*f;
q1=int(Q*cos(n*pi*x/L),x,-L,L)/L;
sigmax_cosine=-(q1*cos(beta*x)*(2*cosh((beta*(h+2*y))/2)-2*cosh((beta*(3*h-2*y))/2)+2*beta...
sigmax_tot=symsum(sigmax_cosine,n,1,Inf);
I must mention that this series is derived from Fourier series of "Q" and after this series I should assign variables (L,x,y) by subs function. The problem is that it doesn't give me the right answer. and also when I type this:
subs(sigmax_tot,[x y L],[0 0.25 2])
It gives me 3050 but when I type:
subs(sigmax_tot,[x y L],[0 -0.25 2])
The answer is: symprod((500*(16*cosh((pi*n)/2) + 2*pi^2*n^2 - 16))/(pi^2*n^2 - 8*cosh((pi*n)/2) + 8), n, 1, Inf) - 3050
and also I can not plot the sigmax_tot over because it gives me this error: "Undefined function 'symprod' for input arguments of type 'double'." can anyone help me to write the appropriate code for this series??
Walter Roberson on 16 May 2015
I would need the rest of the line in order to investigate further.

Walter Roberson on 15 May 2015
The limit of (500*(16*cosh((pi*n)/2) + 2*pi^2*n^2 - 16))/(pi^2*n^2 - 8*cosh((pi*n)/2) + 8) as n approaches infinity is -1000, so you are multiplying together an infinite number of non-zero terms so the result would be -infinity
For further examination I would need the full formula.
Walter Roberson on 16 May 2015
Please confirm that the sigmax_cosine term is
-q1 * cos(beta * x) * (2 * cosh(beta * (h + 2 * y) / 2) - 2 * cosh(beta * (3 * h - 2 * y) / 2) + 2 * beta * y * sinh(beta * (h + 2 * y) / 2) + beta * h * sinh(beta * (3 * h - 2 * y) / 2) + 2 * beta * y * sinh(beta * (3 * h - 2 * y) / 2) - 2 * beta ^ 2 * (h ^ 2) * cosh(beta * (h + 2 * y) / 2) + 5 * beta * h * sinh(beta * (h + 2 * y) / 2) + 4 * beta ^ 2 * h * y * cosh(beta * (h + 2 * y) / 2)) / (4 * beta ^ 2 * (h ^ 2) - 2 * cosh(2 * beta * h) + 2)