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

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??

댓글 수: 3

Did your sigmax_cosine get truncated? The line ends in "..." ?
no it is not truncated. it is a bit long and I didn't write the rest.
I would need the rest of the line in order to investigate further.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2015년 5월 15일

0 개 추천

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.

댓글 수: 5

sigmax_cosine=-(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)))/(2*(2*beta^2*h^2-cosh(2*beta*h)+1));
When I test with that formula using a different symbolic package, I get approximately 7427.234161 for the total with the [0, 1/4, 2] settings, not 3050.
My testing shows that with x=0, L=2, that when y about -.2436338023 or more negative, that the terms become non-negligibly negative so the sum does not converge. That is slightly larger than -1/4 so -1/4 is included: with y=-1/4 the sum does not converge. When -1/4 is substituted in, you can solve() the term over n and demonstrate that the zero crossing is at n = 1/pi, and since the minimum n is 1, all of the components of the sum become strictly negative and not tending to 0.
I solved the problem using for loop instead of symprod for series. I tested different n's from 2000 to 40 and the answer was unchanged so the series should converge when n reaches to approximately 40. My problem is solved but by using for loop and I couldn't use symsum or symprod. I would be happy to know why. Also I should mention that y is limited from -h/2 to h/2.
With that definition for sigmax_cosine I can demonstrate that when y = -h/2 and x = 0, the limit of the term as n goes to infinity is -f/L . As that is on the order of -500, the infinite sum is -infinity. I am not getting an infinite product at all.
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)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

2015년 5월 15일

댓글:

2015년 5월 16일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by