ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 06 Nov 2018 14:04:40 -0600Restriction of domain of vector fieldhttp://ask.sagemath.org/question/44207/restriction-of-domain-of-vector-field/I was trying to plot a field of normal vectors to a given implicit graph. What I got so far is:
x, y = var('x y')
f(x,y) = 2*x*y^3
g(x,y) = x^2*3*y^2
d = plot_vector_field((f(x,y)/sqrt(f(x,y)^2+g(x,y)^2),g(x,y)/sqrt(f(x,y)^2+g(x,y)^2)), (x,-5,5), (y,-5,5))
s = implicit_plot(x^2*y^3-1 , (x,-5,5), (y,-5,5))
show(s+d)
And it works like a charm, however, is there a way to "restrict" a domain of plot_vector_field so it doesn't plot all the vectors in a given range, but only for point (x,y) lying on my graph? That is such points that x^2*y^3=1. I tried to just put it instead (y,-5,5) (in a y=(1/x^2)^(1/3) form), but it obviously doesn't work.
Thx for any help as I'm new to Sage.MichaĆ_FabisiakTue, 06 Nov 2018 14:04:40 -0600http://ask.sagemath.org/question/44207/plot_vector_field3d and three.js viewerhttp://ask.sagemath.org/question/41091/plot_vector_field3d-and-threejs-viewer/ I guess there might be some mistake in my code, but I cannot use `plot_vector_field3d` and show the result with `three.js` viewer. The code is
var('x y z')
f = (x, y, z)
show(plot_vector_field3d(f, (x,-3,3), (y,-3,3), (z,-3,3), aspect_ratio=1), viewer='threejs')
and it only shows an empty box. How to explain this behaviour?jepstraTue, 13 Feb 2018 05:56:22 -0600http://ask.sagemath.org/question/41091/Vector Field example failshttp://ask.sagemath.org/question/40693/vector-field-example-fails/The following example fails with an error message in the last line.
This is an example taken from the "manifold.pdf" reference file, Page 337
I'm using SageMath 8.1 on Windows Native.
sage: S2 = Manifold(2, 'S^2')
sage: U = S2.open_subset('U') # the open set covered by spherical coord.
sage: XS.<th,ph> = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi')
sage: R3 = Manifold(3, 'R^3')
sage: X3.<x,y,z> = R3.chart()
sage: F = S2.diff_map(R3, {(XS, X3): [sin(th)*cos(ph),sin(th)*sin(ph), cos(th)]}, name='F')
sage: F.display() # the standard embedding of S^2 into R^3
sage: v = XS.frame()[1] ; v # the coordinate vector d/dphi
sage: graph_v = v.plot(chart=X3, mapping=F, label_axes=False)
sage: graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9)
sage: graph_v + graph_S2
Moreover, each individual plot does not generate an error, but I don't see any plot, just an empty space!
danielvolinskiFri, 19 Jan 2018 11:02:38 -0600http://ask.sagemath.org/question/40693/Log scale in vector fieldhttp://ask.sagemath.org/question/33889/log-scale-in-vector-field/Is there a way to plot a 2D vector field with log scale in the x-axix? I was using plot_vector_field, but I can't find a way to use log with that.vitorWed, 22 Jun 2016 20:36:07 -0500http://ask.sagemath.org/question/33889/Variable not found while trying to plot a parametric phase portraithttp://ask.sagemath.org/question/30230/variable-not-found-while-trying-to-plot-a-parametric-phase-portrait/ I'm trying to plot a parametric phase portrait of a differential equations system, but i get the following error:
> ValueError: Variable 't' not found
Here's what I'm trying to do:
@interact
def _(a1 = slider(-30, 30, 0.001, default=0, label='a1'),
b1 = slider(-30, 30, 0.001, default=0, label='b1'),
a2 = slider(-30, 30, 0.001, default=0, label='a2'),
b2 = slider(-30, 30, 0.001, default=0, label='b2'),
g1 = slider(-30, 30, 0.001, default=0, label='g1'),
g2 = slider(-30, 30, 0.001, default=0, label='g2'),
auto_update=True):
discriminant = b2^2-2*b1*b2+b1^2+4*a1*a2
pretty_print("discriminant = " + str(discriminant))
if discriminant >= 0:
t = var('t')
M1 = function('M_1', t)
M2 = function('M_2', t)
de1 = diff(M1,t) == a1 * M2 - b1 * M1 + g1
de2 = diff(M2,t) == a2 * M1 - b2 * M2 + g2
plot_vector_field((de1.rhs(),de2.rhs()),(M1,-3,3),(M2,-3,3))
else:
pretty_print("discriminant is negative. adjust parameters")
Can't really figure out why is t not found and how to fix itdnoskovThu, 22 Oct 2015 19:38:10 -0500http://ask.sagemath.org/question/30230/