ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 15 Feb 2019 00:45:50 -0600Conditional Plot, plot f(x+iy) if g(x+iy) satisfies some kind of conditionhttp://ask.sagemath.org/question/45445/conditional-plot-plot-fxiy-if-gxiy-satisfies-some-kind-of-condition/Let's say I have two functions f(zeta) and g(zeta), and I'd like to have 3D-plot and Contour Plot of f(zeta) if g(zeta) in a certain range.
I have defined f(zeta) and g(zeta), and then I tried this command, but Sage said the syntax is not valid.
B=implicit_plot(lambda x,y : float(f(x+y*I)),if 1<g(x+y*I)<3,(-5,5),(-5,5)))
I am pretty new with Sage math, so please bear with me if the question is too trivial....
Wed, 13 Feb 2019 04:55:53 -0600http://ask.sagemath.org/question/45445/conditional-plot-plot-fxiy-if-gxiy-satisfies-some-kind-of-condition/Answer by Emmanuel Charpentier for <p>Let's say I have two functions f(zeta) and g(zeta), and I'd like to have 3D-plot and Contour Plot of f(zeta) if g(zeta) in a certain range. </p>
<p>I have defined f(zeta) and g(zeta), and then I tried this command, but Sage said the syntax is not valid. </p>
<pre><code>B=implicit_plot(lambda x,y : float(f(x+y*I)),if 1<g(x+y*I)<3,(-5,5),(-5,5)))
</code></pre>
<p>I am pretty new with Sage math, so please bear with me if the question is too trivial....</p>
http://ask.sagemath.org/question/45445/conditional-plot-plot-fxiy-if-gxiy-satisfies-some-kind-of-condition/?answer=45468#post-id-45468No elaborate solution (some knowledge of `f` and `g` would come handy). A couple of hints :
* The syntax of a conditional expression in Sage is : `result-if true if condition else result-if-false`. No comma involved.
* `implicit_plot3d?` might make your day (see the `region` argument)... but is damn heavy !
* In the current implementations of `plot3d`, friends and cousins, points having value `float('nan')` do not plot. This might come handy *but is not documented* and might go without warning at the next revision of those functions.
Fri, 15 Feb 2019 00:45:50 -0600http://ask.sagemath.org/question/45445/conditional-plot-plot-fxiy-if-gxiy-satisfies-some-kind-of-condition/?answer=45468#post-id-45468