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.Sat, 22 May 2021 14:16:59 +0200Any SageMath Electromagnetism resources?https://ask.sagemath.org/question/57219/any-sagemath-electromagnetism-resources/Recently, I came across the article "SAGE off Stage: Teaching Electromagnetics with a Symbolic Computation Tool" by Yumin Zhang, David K. Probst. I was wondering, are there any other similar resources? It would be great if it demonstrates plotting electric fields, equipotential surfaces etc.
Others:
> http://matematicas.uam.es/~fernando.chamizo/dark/d_electr.html
>
> https://ernestyalumni.wordpress.com/2016/05/31/electromagnetism/
One on mechanics:
> https://ec.europa.eu/research/participants/documents/downloadPublic?documentIds=080166e5c70c2804&appId=PPGMSChengSat, 22 May 2021 14:16:59 +0200https://ask.sagemath.org/question/57219/Some @interact questionshttps://ask.sagemath.org/question/56552/some-interact-questions/ @interact
def _(a=slider([0,1,.01,0]),b=slider([0,1,0.01,0]),c=slider([.9,0,-.1])):
p=text(r"$1$",(2,10.6),color="black")
p+=text(r"$0$",(2,9.4),color="black")
p+=circle((1,10), 0.1, edgecolor='blue')
p+=text(r"$A$",(1,10),color="black")
p+=line([(1.2,10), (2,10)],color="red")
p+=line([(2,9.5), (2,10.5)],color="red")
p+= circle((2,9.5+a), 0.01,fill=True, edgecolor='red', facecolor='red')
p+=line([(2,9.5+a), (2.5,9.5+a)],color="red")
p+=text(r"$\lambda_0$",(2.25,9.6+a),color="black")
p+=circle((1,10), 0.1, edgecolor='blue')
p+=text(r"$B$",(2.8,9.5+a),color="black")
p+=circle((2.8,9.5+a), 0.1, edgecolor='blue')
p+=line([(3.2,9.5+a), (5.2,11+a)],color="green")
p+=line([(3.2,9.5+a), (4.2,9+a)],color="green")
p+=text(r"$(\lambda_0,1-\lambda_0)$",(4.5,8.75+a),color="black")
p+=text((a,1-a),(4.5,8.5+a),color="black")
p+=text(r"$a$",(3.7,9.1+a),color="black")
p+=text(r"$r$",(4.2,10.5+a),color="black")
p+=line([(5.2,10.5+a), (5.2,11.5+a)],color="green")
p+=text(r"$1$",(5.2,11.6+a),color="black")
p+=text(r"$0$",(5.2,10.4+a),color="black")
p+= circle((5.2,10.5+a+b), 0.01,fill=True, edgecolor='green', facecolor='green')
p+=line([(5.2,10.5+a+b), (5.7,10.5+a+b)],color="green")
p+=text(r"$\lambda_1$",(5.45,10.6+a+b),color="black")
p+=circle((6,10.5+a+b), 0.1, edgecolor='blue')
p+=text(r"$A$",(6,10.5+a+b),color="black")
p+=line([(6.3,10.5+a+b), (7.3,11.5+a+b)],color="red")
p+=line([(6.3,10.5+a+b), (7.3,9.5+a+b)],color="red")
p+=text(r"$a$",(6.8,9.8+a),color="black")
p+=text(r"$r$",(6.8,11.2+a),color="black")
p+=text(r"$(0,0)$",(7.75,11.7+a+b),color="black")
p+=text(r"$(\beta \lambda_1,\beta(1-\lambda_1))$",(7.75,9.2+a+b),color="black")
p+=text((c*b,c*(1-b)),(7.75,8.9+a+b),color="black")
show(p,gridlines=False,axes=False, figsize=8)
1) This interaction is dramaticaly slow. Is there a way to increase its reaction ?
2) Could I use latex characters in the sliders
3) how coul I ask to display only round numbers (I have tried many solutions which doesn't work)CyrilleThu, 08 Apr 2021 11:27:06 +0200https://ask.sagemath.org/question/56552/Exporting @interacthttps://ask.sagemath.org/question/50618/exporting-interact/ Is there a simple solution to export trully a `@interact` cell ?CyrilleTue, 07 Apr 2020 09:00:29 +0200https://ask.sagemath.org/question/50618/Variable not found while trying to plot a parametric phase portraithttps://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 itdnoskovFri, 23 Oct 2015 02:38:10 +0200https://ask.sagemath.org/question/30230/Interact with SAGE over TCPhttps://ask.sagemath.org/question/10212/interact-with-sage-over-tcp/I am going to write a Java program that interacts with Sage. With Wolfram Mathematica I would have used a MathLink interface for this purpose. Does Sage have something similar?
Goolge suggests there is some way to interact over TCP with JSON queries and responses, but the Sage tutorial states only 4 ways of using Sage:
----------
You can use Sage in several ways.
- Notebook graphical interface: see the section on the Notebook in the reference manual and The Notebook
Interface below,
- Interactive command line: see The Interactive Shell,
- Programs: By writing interpreted and compiled programs in Sage (see Loading and Attaching Sage ?les and
Creating Compiled Code), and
- Scripts: by writing stand-alone Python scripts that use the Sage library (see Standalone Python/Sage Scripts).iposovSun, 09 Jun 2013 07:15:32 +0200https://ask.sagemath.org/question/10212/Server/Client hide code, 3D Animation, etc (bachelor thesis)https://ask.sagemath.org/question/9873/serverclient-hide-code-3d-animation-etc-bachelor-thesis/Right now I am evaluting for my bachelor thesis in computer science wich software would be the best to create graphical plots for learning-algorithms like backpropagation (neural networks) oder k-nearest-neighbor (classification) and so on.
Sage seems to be very powerful and covers A HUGE AMOUNT of my needs..
Still.. I could not find an easy way to hide the sourcecode to a user. I require this since I am going to implement some examples for students which they will have to solve on their own. This is why I cannot provide any sourcecode. (%hideall is NOT enough)
I know how I would do this but is there already an easy way to accomplish that?
The other thing is this..
I'd like to create partly interactive 3D animations, for example gradient descent. A student should be able to adapt the learning rate and it would be great if the 3D plot got an animated line that slowly finds its way to the minimal error.
Thank you for your answers.snoocMon, 04 Mar 2013 10:10:29 +0100https://ask.sagemath.org/question/9873/Interactive question in notebookshttps://ask.sagemath.org/question/8650/interactive-question-in-notebooks/When trying to find some solution to [the double integral problem](http://ask.sagemath.org/question/1077/symbolic-expectations-and-double-integrals) and poking around with Sage (4.7.2), I stumbled upon this behavior:
x,y,u,v,p,k=var('x,y,u,v,p,k')
integrate(x+y^k, y)
output (resembles maxima interaction):
Traceback (click to the left of this block for traceback)
...
Is k+1 zero or nonzero?
How can I answer to this (with nonzero)?
**Update**: I accept @god.one solution below as there seems no way as for now to interactively answer those maxima questions. Green diodSat, 21 Jan 2012 10:25:29 +0100https://ask.sagemath.org/question/8650/