2
$\begingroup$

Okay, so I'm having some trouble with some very badly behaved functions. I'll try to phrase the question in general terms to begin with, because the actual equations consist of about 12 numerical parameters each, plus I coded it very poorly by writing parameter names with subscripts and such (which I won't do again..) so copy pasting it looks horrendous and takes quite some time to fix, but if needed I can definitely do it. However, I believe that I can explain and illustrate the issue quite clearly, so perhaps some general methods of fixing this can be thought of.

So, lets start. I have two functions, $V(t)$ and $I(t)$, and I was to plot $I$ versus $V$. So it's a parametric plot problem. Now, what I want to do is plot in a certain region, $V \in [0,2]$. $V(t)$, however, is a rather nonlinear function. It reaches the value $V(t) = 2$ at about $t = 0.01$, then goes to say $V(t) = 1.5$ at $t = 0.2$, and then the trouble starts. Because at this point, $V(t)$ starts to become very slowly changing: it won't reach $V(t) = 0$ until $t = 10^{21}$.

So, this is giving me issues when plotting. If I plot the full thing from $t = 0$ to $t = 10^{21}$, it doesn't look remotely correct. I suppose this is because ParametricPlot tries to interpolate, and fails, because it is such a horrible function. What would be a solution to this?

One thing I have done myself is cut the function into multiple pieces. Taking four ranges of t, I get the following four figures (you can ignore the axes and the fact that there are two curves, they behave similarly as you can see) enter image description here

So in this way I can see that ParametricPlot is definitely able to resolve the regions piece by piece (as I am reproducing figures from a paper I know this is correct), but just not all at once. That's what I'm trying to do, and I was wondering if you have any advice. One way perhaps would be to use Show to combine the different regions, but that seems a bit dirty.

Also, as an aside, I am now plotting directly in terms of t. But if I already know the range in which I want to plot my x-variable $V(t)$, being from 0 to 2, is there a way I can tell Mathematica this directly, without me calculating the values of t and then using those to plot?

$\endgroup$

closed as off-topic by MarcoB, user9660, Kuba, m_goldberg, rhermans Feb 15 '16 at 11:12

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – MarcoB, Community, Kuba, m_goldberg, rhermans
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ Post sample code. $\endgroup$ – David G. Stork Feb 11 '16 at 0:23
  • $\begingroup$ @DavidG.Stork Right, well like I said above that's going to take me a long time, at least an hour. But you are probably right that the problem warrants a more specific approach rather than general ideas on what to do. It's almost 2am here now though, so I guess I'll get back to it tomorrow and write some sample code. Would it be better to delete the question for now, and repost it tomorrow with the added code? $\endgroup$ – user129412 Feb 11 '16 at 0:33
  • 3
    $\begingroup$ You might consider sampling the functions on an exponential scale: i.e. something like t -> PowerRange[0.01, 10^21, 10], and using ListPlot instead. See what this gives you and then refine the grid as needed. As for the last question, I'll think on it. $\endgroup$ – march Feb 11 '16 at 0:37
  • $\begingroup$ @march That does make sense, and would probably work. Now I just have to figure out how to draw a parametric plot using listplot! $\endgroup$ – user129412 Feb 11 '16 at 0:41
  • 3
    $\begingroup$ Oh, that's straightforward: ListPlot[Table[{V[t], I[t]}, {t, PowerRange[0.01, 10^21, 10]}]]. $\endgroup$ – march Feb 11 '16 at 0:42