Drawing more Complicated Graphs in Mathematica

Click For Summary

Discussion Overview

The discussion revolves around the use of Mathematica for plotting complicated graphs derived from functions that involve integration with variable limits. Participants explore methods to efficiently compute and visualize the relationships between these functions over a specified range of values.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Exploratory

Main Points Raised

  • One participant describes a function S[q] derived from integrating A[r,q] over r, with a lower limit rmin that depends on q in a complex way.
  • Another function L[q] is similarly defined, also involving integration with a q-dependent lower limit.
  • There is a request for an efficient method to compute S[q] and L[q] for multiple values of q and plot S[q] against L[q].
  • Some participants suggest creating a table of solutions for different values of q.
  • Questions arise about the feasibility of plotting a graph from such a table without prior knowledge of its shape.
  • One participant proposes using either ParametricPlot or ListParametricPlot in Mathematica, depending on whether the data points are generated explicitly or handled internally.
  • A detailed Mathematica code example is provided, outlining how to define the integrals and solve for rmin in terms of q or vice versa.
  • Participants discuss the implications of the chosen method on the plotting process, indicating that the approach may vary based on the specific setup.

Areas of Agreement / Disagreement

Participants express varying levels of understanding of the original problem, and while some provide potential solutions, there is no consensus on the best approach or clarity on the implementation details.

Contextual Notes

Some limitations are noted regarding the complexity of the dependence of rmin on q, which may affect the integration process and the resulting plots. The discussion does not resolve these complexities.

Who May Find This Useful

This discussion may be useful for Mathematica users dealing with integration problems involving variable limits, particularly in the context of plotting relationships between derived functions in physics or engineering applications.

hufflepup
Messages
6
Reaction score
0
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.
 
Physics news on Phys.org
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?
 
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 basically 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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
5
Views
2K
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
5K