Trying to solve this equation exp^(-((2.​*n+1).*pi/​2).^(2)*t)​/(2.*n+1).​^2 where n varies from 0 to infinity and the final equation is equated to zero to get value of 't'

3 visualizzazioni (ultimi 30 giorni)
My code is written as follows
clear all; close all; clc;
syms t;
equ1=0;
for n=0:Inf
equ = exp^(-((2.*n+1).*pi/2).^(2)*t)/(2.*n+1).^2;
equ1= (equ + equ1);
end
E = equ1 == 0;
S = solve(E,t)
and i'm getting an error as follows:
Error using exp
Not enough input arguments.
Error in aditya_1 (line 5)
equ = exp^(-((2.*n+1).*pi/2).^(2)*t)/(2.*n+1).^2;
Would greatly appereciate any help.

Risposte (2)

Walter Roberson
Walter Roberson il 16 Dic 2015
Modificato: Walter Roberson il 16 Dic 2015
equ = exp(-((2.*n+1).*pi/2).^(2)*t)/(2.*n+1).^2;
exp is not a constant: it is a function.

John D'Errico
John D'Errico il 14 Dic 2020
First, exp is a function. Use it like this:
syms n t
exp(-((2.*n+1).*pi/2).^(2)*t)/(2.*n+1).^2
ans = 
That presumes your parens were correctly placed. Next, you also cannot use solve on the sum, because your loop ran to infinity. Essentially, the loop you build will never terminate, so MATLAB will never get to the step where you tried to solve anything.
Instead, you may try to use symsum.
syms n t
symsum(exp(-((2.*n+1).*pi/2).^(2)*t)/(2.*n+1).^2,n,[0,inf])
ans = 
Sadly, the result is shown as the original sum. And that means MATLAB is unable to solve the infinite sum. We may ask if MATLAB can find a solution for some specific value of t. The obvious case would be t==0.
t = 0;
symsum(exp(-((2.*n+1).*pi/2).^(2)*t)/(2.*n+1).^2,n,[0,inf])
ans = 
Which yields a rather well known result, though I don't recall who first derived the result. It probably goes back to Euler.
Again though, other values of t fail to gain any traction.
t = 1;
symsum(exp(-((2.*n+1).*pi/2).^(2)*t)/(2.*n+1).^2,n,[0,inf])
ans = 
I might guess you need to do some serious mathematics here to go further. Send that fellow Euler an e-mail perhaps. Though if he responds I might worry. :)

Community Treasure Hunt

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

Start Hunting!

Translated by