Drawing more Complicated Graphs in Mathematica

I have a function, S[q] which is obtained by integrating another function, A[r,q] over r.

My problem is that the lower limit of integration,
rmin depends on q in a complicated manner. Mathematica can however solve this equation to give several routes, only one of which is real which is the one I want.

I have a second function too, L[q] which is also obtained by integrating B[r,q] over r. Again the lower limit of integration depends on q in the same manner.

What I want to do is for a given value of q, solve
the equation for rmin, and use this to calculate
the corresponding L[q]. I then wish to calculate
S[q] in the same manner.

I want Mathematica to do this for many values of
q over a range and use the results to plot
S[q] against L[q]. Does anyone know an efficient
way to do this?

Thank you for your help.
 
27,180
3,814
I am not sure I follow your plan very well, but you certainly can make a table where each entry is the solution for a given value of q.
 
Would it be possible to get Mathematica to plot a curved graph from a table like that if you do not know what it is supposed to look like to start with?
 
27,180
3,814
You can either use ParametricPlot or ListParametricPlot depending on if you want to explicitly generate the table of data points, or if you want Mathematica to handle that internally.
 
@hufflepup:dude i too have the same problem.:confused:.
r u able to get nw?
let me know if u cn..
 
Hi sauberss,

you can solve a problem like this as follows:

If F[q] = integral^Infinity_rmin A[r,q]dq

G[q] = integral^Infinity_rmin B[r,q] dq

where ^Infinity and _rmin represent the upper and lower limits of integration respectively, and
rmin= a(q)

Mathematica code:

F[q_]:= NIntegrate[A[r,q], {r, rmin, Infinity}]

G[q_]:=NIntegrate[B[r,q], {r, rmin, Infinity}]

The_]:= notation defines what is called a pattern, and basicly means that these expression won't be evaluated until they are called later, when a specific value of q will be provided.

As the lower limit of integration depends on rmin you now have 2 options, which is easiest will depend on your specific setup:

1) Get Mathematica to solve for rmin in terms of q, rmin=z(q), then replace rmin in the above equations with z(q).

2) Solve for q in terms of rmin, q=w(rmin) and replace the q in the integrals with w(rmin) in which case your equations would look like:

F[rmin_]:= NIntegrate[A[r,rmin], {r, rmin, Infinity}]

G[rmin_]:=NIntegrate[B[r,rmin], {r, rmin, Infinity}]

Note that these are of the form F[rmin_] not F[w(rmin)_] becuse the expression in the []
just telss Mathematica which variables will be replaced with numbers later.


To plot your graphs you then do:

graphname = ParametricPlot[{F[q], G[q]}, {q, qmin, qmax}]

OR

graphname = ParametricPlot[{F[rmin], G[rmin]}, {rmin, rminmin, rminmax}]

depending whether you went down path 1) or 2)

where qmin/rminmin and qmax/rminmax define the range of q/rmin over which you want to plot the graph.

I hope this helps you.
 

The Physics Forums Way

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top