How can I remove some specific terms from a function?
Mostra commenti meno recenti
Dear sir, I am trying to write a code that can generate the specific terms from certain function. However, I just cannot find a way to remove the exponential terms. I have a list of functions that generate by same function, that all look like f=a!*sqrt(b+c*i)*exp(-dk+sqrt(b+c*i)), where a,b,c,d are all changing variable. I want to remove all the terms of exp(), so as to use the first two part for next step of calculation. How to do this? Thank you.
To be concrete, here is my formula sheet.
if true
format long;
h=1.05457173e-34;
t=1e25*365*24*3600;
m=60;
a=1/1000;
syms x k;
int(exp(i*k*x-i*h*k^2*t/(2*m)-k^2*a^2/2),k,-Inf,Inf)
f=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/((10126067097211690078125*i)/365375409332725729550921208179070754913983135744+ 1/2000000)^(1/2)
g=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/((158219798393932657470703125*i)/5708990770823839524233143877797980545530986496+1/2000000)^(1/2)
u=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/(27714145064399998094084151567728884845503502656025676347457107551846400*i+ 1/2000000)^(1/2)
o=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/((1756592631284943967788998796645*i)/633825300114114700748351602688+ 1/2000000)^(1/2)
q=pi^(1/2)*(sqrt(a/(2*pi^(3/2))))/((89937542721789151668027362145*i)/324518553658426726783156020576256+ 1/2000000)^(1/2)
Z=(real(f))^2;
SD=1/(sqrt(2*pi)*Z)
end
The f g u o q, is some example with different t I done, but actually I need to do for more than 100 times for data analysis. As you see, the integral will generate sth with exp(),and f g u o q are all eliminated by myself.
1 Commento
Walter Roberson
il 11 Nov 2013
Are you using the symbolic toolbox? If not then how is your function represented ?
Risposta accettata
Più risposte (2)
Image Analyst
il 11 Nov 2013
Does the delete key not work on your computer? Simply delete the term and do this:
f1 = factorial(a)*sqrt(b+c*i);
1 Commento
Michael
il 11 Nov 2013
Why don't you multiply the different part of the equation by different terms e.g Q=1, R=1, S=1, etc and the these terms to zero when you don't want to use the respective part of the equation.
Categorie
Scopri di più su Mathematics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!