Message Boards Message Boards

0
|
649 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Solving and plotting with incomplete gamma function

In the following code I want to plot fplot1 vs P by substituting r from f[r]==0 in the expression of fplot1. I think the expression of incomplete Gamma function is making problem here. Can any one tell me what am i doing wrong here? Similar discussion- here.

POSTED BY: Debojyoti Mondal
3 Replies

Give a bounded interval to NSolve:

NSolve[f[r, P] == 0 && 10 > r > 0, r, Reals]

This way it will be much faster.

POSTED BY: Gianluca Gorni

By the way, when I copy the code from the browser and paste it into Mathematica (I am nostalgic of the old Greek name), the integral from 1 to Infinity becomes from Infinity to 1. It looks like a bug.

POSTED BY: Gianluca Gorni

Define epsilon to be a function of r (ε[r_] :=...) and change the formula for f[r] to use ε[r].

When the function f[r1, P1] is evaluated, first the literal instances of the symbols r and P in the (unevaluated) formula for f are replaced by r1 and P1. The symbol epsilon remains the symbol epsilon. After this replacement, the application of f is complete, and the resulting expression is evaluated. During this evaluation, epsilon is evaluated and the symbol r in it appears. But the application of f is done; so the r remains, the value of the function not a number.

A standard check one should try when a plot is blank is to evaluate the function at some numbers. For instance fPlot[0.1]. If you don't get a number, then that's why the plot is blank. The next step is to track down why the value was not a number.

POSTED BY: Michael Rogers
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