ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 14 May 2020 04:16:32 -0500How do I convert a 6th degree curve to an elliptic curve?https://ask.sagemath.org/question/51403/how-do-i-convert-a-6th-degree-curve-to-an-elliptic-curve/ How do I convert a 6th degree curve to an elliptic curve?
exp: How does y^2=16*x^6-32*x^5+272*x^4+4096*x^2-8192*x+69632 curve convert to elliptic curve?
Thanks.
GamzeeeThu, 14 May 2020 04:16:32 -0500https://ask.sagemath.org/question/51403/using pade approxhttps://ask.sagemath.org/question/39870/using-pade-approx/ Hi 1) From the only example I found
s = PowerSeriesRing(QQ,'s').gen()
a=exp(s);a.pade(4, 0)
type(a)
it seems this works for type 'sage.rings.power_series_poly.PowerSeries_poly'
But I have a type 'sage.symbolic.expression.Expression' b,
and was unable to convert b to the type required to apply pade
2) There's an alternative rational.reconstruct , but that seems to be geared to computations modulo (n)
3) In conclusion, it seems at current stage the simplest is to write one's own Pade? Thanks, Florin
florinFri, 01 Dec 2017 04:13:14 -0600https://ask.sagemath.org/question/39870/using Jupiter notebooks .ipynb created on Windows (Oracle VM virtual box) on sage, linuxhttps://ask.sagemath.org/question/39773/using-jupiter-notebooks-ipynb-created-on-windows-oracle-vm-virtual-box-on-sage-linux/ Hi
1) I use Jupiter notebooks .ipynb created on Windows (Oracle VM virtual box) at home, and would like to upload and use them
on our linux sage installation, in our University
It seems this is impossible (upload of .ipynb is refused by linux sage)
2) As a substitute, I noticed on a notebook .sage created by someone else that it is at least pure text, and hence can be copied-pasted on a new file in the linux machine.
Is it possible to convert my .ipynb notebooks to .sage notebooks? This would allow using them both as notebooks and as a source of copypaste when upload is refused.
In fact, can .sage files be created on Windows (Oracle VM virtual box)?
Thanks, FlorinflorinFri, 24 Nov 2017 14:08:25 -0600https://ask.sagemath.org/question/39773/How converting some number of different base to 10 to base 10?https://ask.sagemath.org/question/38979/how-converting-some-number-of-different-base-to-10-to-base-10/Hello, how can I convert some number into different base at 10, to the base 10 in Sage?
For example: convert ( EAEI in base 36 ) = 666666 into base 10.
In advance thank you very much for your help.
Best regardsBruceTRTue, 26 Sep 2017 15:55:16 -0500https://ask.sagemath.org/question/38979/unexpected behaviors with Sage 8.0 on Machttps://ask.sagemath.org/question/38639/unexpected-behaviors-with-sage-80-on-mac/I'm having some weirdnesses with my Sage 8.0 installation. I run Sage via the app, not the command line. Here's the story.
I upgraded to Sage 8.0. It made me create a folder to contain Jupyter notebooks. I found the menu item to upgrade notebooks individually. I picked my favorite and oldest notebook ("experiments") to upgrade. I ran a semi-arbitrary cell, which worked fine (mostly---it told me to install JDK, which I have installed so didn't install, and then Sage displayed the graphics properly). I created a couple of new cells. I saved the file.
This is where things get weird.
- The converted/saved notebook isn't showing up in the default notebook list, which is empty even on refresh.
- The converted/saved notebook isn't showing up in the Jupyter notebooks folder.
- The Jupyter interface that opens automatically when I start Sage 8.0 is at localhost:8888.
- The converted notebook was somewhere under localhost:8889.
- I restarted everything (app, Jupyter server, upgrade server) and, because the converted notebook was nowhere to be found, I re-converted it and re-ran something in it. That's showing up as under localhost:8890.
- Nothing showed up under the Running list for localhost:8888 until I created a new notebook there (which also appeared in all the other places I expected it to appear). The first converted notebook shows up under the Running list for localhost:8889. The second converted notebook shows up under the Running list for localhost:8890.
So... I can't tell whether I don't understand the new (Jupyter) paradigm, or whether something's gone wrong with my setup. How is saving/accessing/re-accessing converted notebooks supposed to work? What should I be doing differently?
Edited to add: The converted notebooks have been found (by accident): They ended up in my root directory instead of the default Jupyter directory. Still seems like things are not acting as they should.smbelcasThu, 24 Aug 2017 08:19:25 -0500https://ask.sagemath.org/question/38639/converting to sympyhttps://ask.sagemath.org/question/8847/converting-to-sympy/Dear All
I would like to convert a sage equation to sympy, eg
x=var('x')
y=2*x+Ei(x)
y._sympy_()
... and get complains that Ei is not defined in sympy.
How can I define a (possibly fake) Ei function in sympy from sage?
Or is there any other way to avoid the problem?
Thanks
ValeryvwMon, 02 Apr 2012 07:22:57 -0500https://ask.sagemath.org/question/8847/Display decimal as a fraction?https://ask.sagemath.org/question/10301/display-decimal-as-a-fraction/The number 1.5 represents 3/2 in decimal form.
In sage I can get 3/2 to display as a decimal: 3/2.n()
I haven't had any luck converting 1.5 to a fraction.bxdinSun, 30 Jun 2013 13:32:27 -0500https://ask.sagemath.org/question/10301/Convert derived SI units to base unitshttps://ask.sagemath.org/question/10260/convert-derived-si-units-to-base-units/How can I convert SI units involving temperature (kelvin) to their base units?
Example using units of heat capacity:
# Temperature units multiplied by other units cannot be converted
blah = units.energy.joule/units.temperature.kelvin
blah.convert()
>Traceback (click to the left of this block for traceback)
>...
>ValueError: Cannot convert
I need this output:
units.energy.joule.convert()/units.temperature.kelvin.convert()
>`kilogram*meter^2/(kelvin*second^2)`
There is a discussion of this issue at the link below, but there should be a function to convert to base units in the absence of numerical values.
Link: [https://groups.google.com/forum/#!searchin/sage-devel/convert%28%29/sage-devel/q0MwrPYAuNI/klJNkSNHaXAJ]
Does anyone know how to do this?stanThu, 20 Jun 2013 02:10:16 -0500https://ask.sagemath.org/question/10260/Unit conversionhttps://ask.sagemath.org/question/9555/unit-conversion/I'm not certain if the behaviour is correct in this example, or I am possibly misunderstanding something. Sorry about the lengthy example, but I had difficulties simplifying it into a simpler one.
# Setup units
lbf = units.force.pound_force;
inch = units.length.inch;
sec = units.time.second;
psi = lbf / inch^2;
gal = 231.0*inch^3;
min = 60.0*sec;
gpm = gal/min;
hole = gpm/sqrt(psi);
# Define the given constraints
FLext = 20000.0*lbf;
vext = 15.0*inch/sec;
FLret = -10000.0*lbf;
vret = -15.0*inch/sec;
# Assumed values
Ps = 3000.0*psi;
pv = 1.0;
pc = 1.4;
# System of 3 equations, 3 unknowns
ABE = var('A_BE');
ARE = var('A_RE');
kv = var('k_v');
eq1 = vext^2 == (Ps*ABE - FLext) * kv^2 / ABE^3 / (1 + pv^2 * pc^(-3));
eq2 = vret^2 == (FLret + Ps*ARE) * kv^2 / ARE^3 / (1 + pv^2 * pc^3);
eq3 = pc == ABE / ARE;
sol = solve([eq1, eq2, eq3], [ABE, ARE, kv], solution_dict=True);
sol = sol[1];
show(sol[ABE])
show(sol[ARE])
show(sol[kv])
# Showing the units of various variables
show(sol[kv].convert())
show(hole.convert())
show( (sol[kv]/hole).convert() ) # this should be dimensionless
# Showing the potential bug with unit conversion
show(sol[kv].convert(hole)) # ValueError: Incompatible units
Running the code, the section labelled `# Showing the units of various variables`, you can see the various units of the relevant variables. The code for `show( (sol[kv]/hole).convert() )` should return a dimensionless value, however it still shows units in the result. Looking at the non-numeric portions of it, everything appears to cancel. Running `show(sol[kv].convert(hole))` results in `ValueError: Incompatible units`. I expected a conversion into gpm/sqrt(psi) (i.e. holes).
What concerns me is my calculator (TI-92+) has conversion difficulties with this unit as well, being unable to convert. Is this the expected/normal/ideal behaviour for sage? If so, for what reason(s)? If not, what should I do?
Thank you,
menturimenturi628Wed, 21 Nov 2012 13:06:03 -0600https://ask.sagemath.org/question/9555/convert sage complex matrix into numpy matrixhttps://ask.sagemath.org/question/10094/convert-sage-complex-matrix-into-numpy-matrix/I want to convert a sage matrix with complex elements to a numpy (scipy) matrix. Then I want to manipulate the resulting matrix with commands from linalg.
I have some problem. For example consider the following lines
m=matrix([[I,2],[3,4]])
import numpy
npm=numpy.array(m)
from numpy import linalg
linalg.eig(npm)
the result is an error:
...
TypeError: function not supported for these types, and can't coerce safely to supported types
why does it not work?
('Sage Version 5.8, Release Date: 2013-03-15' on osx 10.6.8)abcMon, 06 May 2013 13:45:13 -0500https://ask.sagemath.org/question/10094/convert expression to functionhttps://ask.sagemath.org/question/8985/convert-expression-to-function/Hola,
is there a way to convert symbolic expression to proper functions?
E. g. `s = sin(x)` into `x |--> sin(x)`
So far I've been using f(x) = s(x), however, deprection warnings occur:
`DeprecationWarning: Substitution using function-call syntax and unnamed
arguments is deprecated and will be removed from a future release of Sage; you
can use named arguments instead, like EXPR(x=..., y=...)`MathemageSat, 19 May 2012 23:52:44 -0500https://ask.sagemath.org/question/8985/converting to sympyhttps://ask.sagemath.org/question/8845/converting-to-sympy/Dear All
I would like to convert a sage equation to sympy, eg
x=var('x')
y=2*x+Ei(x)
y._sympy_()
... and get complains that Ei is not defined in sympy.
How can I define a (possibly fake) Ei function in sympy from sage?
Or is there any other way to avoid the problem?
Thanks
ValeryvwMon, 02 Apr 2012 07:22:20 -0500https://ask.sagemath.org/question/8845/Convert Sage's Graph to NetworkX graphhttps://ask.sagemath.org/question/8715/convert-sages-graph-to-networkx-graph/I want to use a function of networkx. More specifically I want to use the function
double_edge_swap()
provided in the networkx package included in Sage. For more information see [here](http://networkx.lanl.gov/reference/generated/networkx.generators.degree_seq.double_edge_swap.html#networkx.generators.degree_seq.double_edge_swap).
But, I have a Sage graph constructed with:
Graph()
So I want to convert the Sage's Graph() object to a networkx object. How I do that?
Best regards.juanpoolMon, 13 Feb 2012 04:03:40 -0600https://ask.sagemath.org/question/8715/Using symbolic expressions with numpy arrayshttps://ask.sagemath.org/question/8383/using-symbolic-expressions-with-numpy-arrays/Assume I have some symbolic function like
f(x,y,z)=x^2*sin(y)*z
Now I want to evaluate it numerically using numpy arrays, like
import numpy as np
X=np.linspace(-1,1,10)
Y,Z=X,X
f(X,Y,Z)
That produces an error
blabla...
NotImplementedError: Numpy arrays are not supported as arguments for
symbolic expressions
Can I convert a symbolic function into a python functions, so that I can us numpy with it? I fear there surely is a documented way to do to this somewhere - but I cannot find it.XaverSun, 16 Oct 2011 00:39:28 -0500https://ask.sagemath.org/question/8383/Mathematica graphics in a sage notebookhttps://ask.sagemath.org/question/8339/mathematica-graphics-in-a-sage-notebook/**Is there an easy way to get Mathematica graphics into a sage notebook?**
I have a notebook where I want to compare the Mathematica way of doing things and the related graphics to the sage way and its graphics. The naive ways of doing it do not work:
----
%mathematica
Plot[Sin[x],{x,-4,4}]
just produces
-Graphics-
While
mathematica('Plot[Sin[x],{x,-4,4}]')
returns the `InputForm` of the graphics, i.e.,
Graphics[{{{}, {}, {Hue[0.67, 0.6, 0.6], Line[{<<long list of points>>}],
<<some graphics options>>]
----
There's three work-arounds I can currently think of.
1. Export the graphics from Mathematica using: `Export["file.png", graphics]`
and import it back into sage - but I couldn't find an image import function in sage...
2. Use the JavaGraphics Mathematica package: So
![because code formatting was failing me](http://i.imgur.com/BaPvQ.png)
but this puts the graphics object in a separate window (not in the sage notebook).
3. Extract the graphics data and feed it into a sage plotting function, e.g.
list_plot(mathematica('Plot[Sin[x], {x, -4, 4}][[1, 1, 3, 2, 1]]').sage(), plotjoined = true)
which does what I want, but is a little cumbersome - especially for more complicated graphics.
SimonTue, 20 Sep 2011 17:33:54 -0500https://ask.sagemath.org/question/8339/Converting kernel to matrixhttps://ask.sagemath.org/question/7859/converting-kernel-to-matrix/I construct a matrix A and compute its kernel by
A = matrix(GF(2),vectors)
B = A.kernel()
Now I want to convert B to a matrix, such that I can use .nrows() and other matrix-methods, how to do that?MustafaSun, 09 Jan 2011 00:15:35 -0600https://ask.sagemath.org/question/7859/