Message Boards Message Boards

Plot a numerical integration as a function of variable

Posted 1 month ago

Hi, I hope you are doing well.

I was trying to get a numerical integration from the following function

(Nu)^3 r/(Exp[h Nu/(K T2)] - 1)

where T is a function of r and has quite a complexity
I received the error after running the following code

\[Nu]1 = 0; \[Nu]2 = 1;
n = 50;
\[Nu] = Range[\[Nu]1, \[Nu]2, (\[Nu]2 - \[Nu]1)/(n - 1.)];
L1[\[Nu]_, r_] := (\[Nu]e[[1, 1]])^3 r/(h \[Nu]e[[1, 1]]/(K T1));

points = Map[{#, NIntegrate[L1[r, #], {r, 6.49, 71.39}]} &, \[Nu]]
ListLinePlot[points]...

the errors are as follows

NIntegrate::izero: Integral and error estimates are 0 on all integration subregions. Try increasing the value of the MinRecursion option. If value of integral may be 0, specify a finite value for the AccuracyGoal option.

Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.

NIntegrate::precw: The precision of the argument function (Indeterminate if Re[r]>0.*10^-20||r[NotElement][DoubleStruckCapitalR]) is less than WorkingPrecision (MachinePrecision).

NIntegrate::inumri: The integrand Indeterminate if Re[r]>0.*10^-20||r[NotElement][DoubleStruckCapitalR] has evaluated to Overflow, Indeterminate, or Infinity for all sampling points in the region with boundaries {{6.49,71.39}}.

Power::infy: Infinite expression 1/0. encountered.

Attachments:
POSTED BY: Fatemeh Aliyan

First of all, beware of MatrixForm: this is for display only, never use it in in calculation. For example,

Y = Table[y, {a, {.1, .5, .8, .9, 1}}] // MatrixForm;

messes up all calculations involving Y, and the semicolon at the end suppresses display, which defeats the only purpose of MatrixForm. Either remove MatrixForm or write it this way:

(Y = Table[y, {a, {.1, .5, .8, .9, 1}}]) // MatrixForm

Next, when you define L1[\[Nu]_, r_], the right-hand side does not contain \[Nu]. Are you sure this is what you mean? Also, the right-hand side evaluates to Indeterminate.

Your definition of points contains L1[r, #], with r as first argument, after you defined L1 with r as second argument.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract