ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 20 Dec 2013 05:43:02 +0100Solve equation 1/3*x + sin(2*x)==1https://ask.sagemath.org/question/10833/solve-equation-13x-sin2x1/ Hi all.
I have the equations
y - 1 == 0,
y == 1/3*x + sin(2*x)
and I want solutions. I know by the intermediate value theorem that there are two solutions : about x=0.5 and x=1.25.
I'd like Sage to give me these solutions. I already tried to_poly_solve=True and/or explicit_solutions=True.
As an example of failure :
sage: solve( 1/3*x + sin(2*x)==1,x,explicit_solutions=True )
[]
What can I do ?
Thanks
Laurent ClaessensSun, 15 Dec 2013 03:26:48 +0100https://ask.sagemath.org/question/10833/solve-equation-13x-sin2x1/Answer by tmonteil for <p>Hi all.</p>
<p>I have the equations</p>
<pre><code>y - 1 == 0,
y == 1/3*x + sin(2*x)
</code></pre>
<p>and I want solutions. I know by the intermediate value theorem that there are two solutions : about x=0.5 and x=1.25.
I'd like Sage to give me these solutions. I already tried to_poly_solve=True and/or explicit_solutions=True.</p>
<p>As an example of failure :</p>
<pre><code>sage: solve( 1/3*x + sin(2*x)==1,x,explicit_solutions=True )
[]
</code></pre>
<p>What can I do ?</p>
<p>Thanks
Laurent Claessens</p>
https://ask.sagemath.org/question/10833/solve-equation-13x-sin2x1/?answer=15817#post-id-15817The function `solve()` aims at finding solutions *symbolically*, and it seems that Sage is not able to do it for your equation. If you want to solve your equation *numerically*, you can use the function `find_root()` as follows:
sage: find_root(1/3*x + sin(2*x) - 1, 0, 1)
0.49428348982550824
sage: find_root(1/3*x + sin(2*x) - 1, 1, 2)
1.261800196654962
Sun, 15 Dec 2013 07:44:38 +0100https://ask.sagemath.org/question/10833/solve-equation-13x-sin2x1/?answer=15817#post-id-15817Comment by Laurent Claessens for <p>The function <code>solve()</code> aims at finding solutions <em>symbolically</em>, and it seems that Sage is not able to do it for your equation. If you want to solve your equation <em>numerically</em>, you can use the function <code>find_root()</code> as follows:</p>
<pre><code>sage: find_root(1/3*x + sin(2*x) - 1, 0, 1)
0.49428348982550824
sage: find_root(1/3*x + sin(2*x) - 1, 1, 2)
1.261800196654962
</code></pre>
https://ask.sagemath.org/question/10833/solve-equation-13x-sin2x1/?comment=16520#post-id-16520Thanks for your answer, tmonteil. That solves the equation with enough accuracy for my purpose but it does not solves my full problem because I have a system.
Ultimately I would like to know the intersection points of two curves. In my example the second curve was too easy : y-1=0.
Since many painting softwares are able to fill the region between two curves (e.g. pstricks), I guess this is possible ...Fri, 20 Dec 2013 05:43:02 +0100https://ask.sagemath.org/question/10833/solve-equation-13x-sin2x1/?comment=16520#post-id-16520