i have this exp function in matlab
a1=(exp(-beta0*abs(z-zaks)));
b1=(ohmi*exp(-2*beta0*H)*exp(-beta0*(z+zaks)))
c1=(ohmu*exp(beta0*(z+zaks)))
f1=(ohmu*ohmi*exp(-2*beta0*H)*exp(beta0*abs(z-zaks)))
g1=2*beta0*(1-(ohmu*ohmi*exp(-2*beta0*H)))
h1=(a1+b1+exp(c1)+f1)
j1=exp(h1)
gpm=j1/g1
with
beta0=1.411608078945960e+20 + 8.949434210398852e-26i
betai=[1.411608078945960e+20 + 8.949434210398852e-26i 1.411608078945960e+20 + 1.398349095374821e-26i 1.411608078945960e+20 + 1.398349095374821e-27i 1.411608078945960e+20 + 1.398349095374821e-26i]
ohmi=[9.803212783111246e-92 + 2.674639380309578e-46i 2.428723887707741e-93 + 4.457732300515962e-47i -2.428723887707741e-93 - 4.457732300515962e-47i;1.411608078945960e+20 + 1.398349095374821e-26i]
ohmu=1.004853842833425e-91 + 3.169942969255795e-46i
z=zaks=4950
H=5000
and it return to be inf even if i had using vpa or sym in it what should go wrong with this?
It also depends on whether you used vpa
correctly:
>> vpa(1e400)
ans =
Inf
>> vpa('1e400')
ans =
1.0e400
So you always have to prevent matlab from evaluating something large/small before using vpa
. Now, this doesn't solve your problem, since
>> vpa(exp(1.3975e+024 +8.8599e-022*i))
ans =
Inf + Inf*i
>> vpa('exp(1.3975e+024 +8.8599e-022*i)')
ans =
Inf + Inf*i
>> exp(vpa('1.3975e+024 +8.8599e-022*i'))
ans =
RD_INF + RD_INF*i
so regardless of the approach you use, you will get infinity for all intents and purposes.
Why is that, you might ask? Consider that
exp(710)
ans =
Inf
Now, your number is roughly equal to
exp(1397500000000000000000000)
or
10^606926538459794441764864
or
1e606926538459794441764864
Of course I ignored a teeny-tiny imaginary part, but that doesn't change much. You do realise that it's a very big number, right?
So, as @BillBokeey has already commented: what do you plan to do with this number? Your best options are probably doing anything you want on paper first, and reach a result that can be handled by a computer.