5
$\begingroup$

How can I solve this?

Solve[y == E^(Sin[5 (x - 3/100 y)] + 1), y]

Solve::nsmet: This system cannot be solved with the methods available to Solve.

This is actually what I want to do. (the closed form solution is not important though).

Plot[Evaluate[
  y /. Solve[y == E^(Sin[5 (x - 0.03 y)] + 1), y][[1, 1]]], {x, 0, 
  10}, GridLines -> Automatic]
$\endgroup$

4 Answers 4

8
$\begingroup$

Since you specify that the closed form of the equation is not important and that you only want the plot, try ContourPlot:

ContourPlot[y == E^(Sin[5 (x - 3/100 y)] + 1), {x, 0, 10}, {y, 0, 10}]

ContourPlot of the equation in question

You may also want to familiarize yourself with RegionPlot and DensityPlot.

$\endgroup$
2
  • $\begingroup$ I tried with a similar equation. Why would this not work? It doesn't produce anything. ContourPlot[ y == (0.1 Sin[5 x] - 1 - 30/100 y )^2, {x, 0, 10}, {y, 0, 10}, GridLines -> Automatic] $\endgroup$
    – hana
    Commented Nov 20, 2022 at 23:05
  • $\begingroup$ @hana The LHS and the RHS do not cross for that equation in the region of $x \in [0,10]$ and $y \in [0,10]$. $\endgroup$
    – eyorble
    Commented Nov 21, 2022 at 2:10
6
$\begingroup$
  • We can solve the original equation by x respect to y.
Clear[eqn, sol];
eqn = y == E^(Sin[5 (x - 3/100 y)] + 1);
sol = SolveValues[eqn, x, Reals]
Plot[sol /. C[1] -> Range[-5, 5], {y, 1, E^2}, 
 AxesLabel -> {Style["y", 15, Blue], Style["x", 15, Blue]}]

enter image description here

enter image description here

  • Use ParametricPlot to interchange x and y.
ParametricPlot[
 Thread[{sol, y}] /. C[1] -> # & /@ Range[-5, 5], {y, 1, E^2}]

enter image description here

  • Reply to the comment @hana.

The new equation eqn = y == (0.1 Sin[5 x] - 1 - 30/100 y)^2; have not real solution.

eqn = y == (0.1 Sin[5 x] - 1 - 30/100 y)^2;
Reduce[Rationalize[eqn, 0], {x, y}, Reals]

False

$\endgroup$
5
$\begingroup$

You could also use FindRoot

pts = Table[{n, y /. FindRoot[y == (E^(1 + Sin[5 (x - (3 y)/100)]) 
         /. x -> n), {y, n}]}, {n, 0, 10, .1}]

ListLinePlot[pts, Mesh -> All, AxesLabel -> {"x", "y"}, 
 MeshStyle -> Red, GridLines -> Automatic, 
 GridLinesStyle -> LightGray]

Mathematica graphics

$\endgroup$
4
$\begingroup$
eq = y == E^(Sin[5 (x - 3/100 y)] + 1);

Outline:

(each section is independent from the others)

  • Getting an interpolation function using NDSolve

  • Getting a quick list plot with FindInstance using periodicity


Getting an interpolation function using NDSolve

Following the same method as a previous answer I wrote one can turn a non linear equation with parameters to a differential equation where the variable over which the differential equation is defined is one of the parameters of the original equation. Then one can (numerically) solve that equation.

The differential equation:

deq = D[eq /. y -> y[x], x]

An initial condition for the differential equation is needed:

y0 = y /. FindInstance[eq /. x -> 0, y][[1, 1]]

The output is a root object.

Solve the differential equation and plot the solution :

yinterp = NDSolveValue[{deq, y[0] == y0}, y, {x, 0, 10}] 

Check the error by verifying whether yinterp solves the original equation:

eq /. y -> yinterp[x] /. Equal -> Subtract  // 
 Plot[#, {x, 0, 10}, PlotLabel -> "Error"] &

enter image description here


Getting a quick list plot with FindInstance using periodicity

{Mod[x, (2 Pi)/5], y} /. 
  FindInstance[eq, {y, x}, Reals, 1000] // ListPlot

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.