# For loop to plot non linear equation

**URL:** <https://community.wolfram.com/t/for-loop-to-plot-non-linear-equation/6606>\
**Category:** Questions\
**Tags:** physics\
**Created:** [September 4, 2015, 1:41pm UTC](https://community.wolfram.com/t/for-loop-to-plot-non-linear-equation/6606 "2015-09-04T13:41:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![svij25](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@svij25](https://community.wolfram.com/u/svij25)\
**Post date:** [September 4, 2015, 1:41pm UTC](https://community.wolfram.com/t/for-loop-to-plot-non-linear-equation/6606/1 "2015-09-04T13:41:04Z")

</div>

I want to plot a graph between eta and tau in the program attached with this post. But my program is giving the errors. Can someone help me to solve it?

---

<div class="post-metadata">

**Author:** ![bsimpson141421356](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bsimpson141421356](https://community.wolfram.com/u/bsimpson141421356)\
**Post date:** [September 4, 2015, 5:53pm UTC](https://community.wolfram.com/t/for-loop-to-plot-non-linear-equation/6606/2 "2015-09-04T17:53:30Z")

</div>

Eliminate your For loop, partly because your Tau is already being used in several different other ways.

```
f = {a[\[Tau]], k1[\[Tau]], e3e[\[Tau]]} /. NDSolve[{a'[\[Tau]]-Sqrt[A*(1-1/a[\[Tau]]^4)+B1*Log[a[\[Tau]]]] == 0, 
      k1[\[Tau]] - Sqrt[1 - wpow^2 - (4*pi*ncao3)/(3*(a[\[Tau]])^3*(1/wpeow^2 - 1/(3*(a[\[Tau]])^3)))] == 0,
      e3e[\[Tau]] - Abs[(3*k1[\[Tau]]^2*(vc)^2)/(72*(1 - wpow^2/9 - k1[\[Tau]]^2))*((4*(nco)*wpow^2)/
         ((1 - wpeow^2/(3*(a[\[Tau]])^3))^2 *4*(1 - wpeow^2/(12*(a[\[Tau]])^3))) + wpow^2)] == 0, 
      a[0] == 1.05}, {a[\[Tau]], k1[\[Tau]], e3e[\[Tau]]}, {\[Tau], 0.005}][[1]];
Plot[f[[1]], {\[Tau], 0, 0.05}, PlotStyle -> {Thickness[0.006]}, AxesLabel -> {\[Tau], a}, PlotRange -> {0, 2}]
Plot[f[[3]], {\[Tau], 0, 50*10^-3}, PlotStyle -> {Thickness[0.006]}, AxesLabel -> {\[Tau], e3e}, PlotRange -> {0, 0.3}]

```

---

<div class="post-metadata">

**Author:** ![svij25](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@svij25](https://community.wolfram.com/u/svij25)\
**Post date:** [September 6, 2015, 8:32am UTC](https://community.wolfram.com/t/for-loop-to-plot-non-linear-equation/6606/3 "2015-09-06T08:32:22Z")

</div>

Thanks Sir for your reply. I have changed my program according to your suggestion but still it is giving the errors like

NDSolve::dsvar: 1 cannot be used as a variable. \>\>  
and others. Kindly suggest me accordingly.
