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.Fri, 23 Oct 2020 16:21:35 -0500Tiny results of find roothttps://ask.sagemath.org/question/54012/tiny-results-of-find-root/ I was finding roots with a simple loop but got two odd results:
g(x) = (x^2)*cos(2*x)
for num in [-10..10,step=.1]:
try:
root=find_root(g,num,num+.1)
print(root)
except:
pass
-8.639379797371932
-7.0685834705770345
-5.497787143782152
-3.9269908169872405
-2.356194490192345
-0.7853981633974483
-7.755114791616843e-09
Are these two actual roots or a numerical error and how would I tell the difference?
7.755077210568017e-09
0.7853981633974483
2.356194490192345
3.9269908169872405
5.497787143782152
7.0685834705770345
8.639379797371932
cybervigilanteFri, 23 Oct 2020 16:21:35 -0500https://ask.sagemath.org/question/54012/Sage symbolic math simplification errorhttps://ask.sagemath.org/question/53345/sage-symbolic-math-simplification-error/In sagemath version 9.1, the code
product(1-q^x, x, 1, N)
returned
-(-1)^N*product(q^x - 1, x, 1, N)
while the correct result ought to be
(-1)^N*product(q^x - 1, x, 1, N)
What went wrong? Where did this sign change come from?ShoutOutAndCalculateSun, 06 Sep 2020 20:21:09 -0500https://ask.sagemath.org/question/53345/Why is Galois group computation failing?https://ask.sagemath.org/question/51944/why-is-galois-group-computation-failing/ L = NumberField(x^2 - x - 1, 'theta')
G = L.galois_group()
works
L = NumberField(x^3 - x - 1, 'theta')
G = L.galois_group()
gives me the error
TypeError: You must specify the name of the generator.
rain1Sat, 13 Jun 2020 05:42:27 -0500https://ask.sagemath.org/question/51944/Unexpected error in a notebookhttps://ask.sagemath.org/question/50980/unexpected-error-in-a-notebook/ I have a long notebook which works nicely. And, suddenly, when I call an already defined function I have this error message
unsupported operand parent(s) for -: 'Integer Ring' and '<class 'sage.plot.graphics.Graphics'>'
Could someone help me to understand what happen ? I cannot give the code here it is too hudge because I have tried to do as in Mathematica a self contain notebook.CyrilleThu, 23 Apr 2020 23:15:12 -0500https://ask.sagemath.org/question/50980/Random errors when using Singular via Sagehttps://ask.sagemath.org/question/50599/random-errors-when-using-singular-via-sage/Hello everyone,
I'd like to use Singulars capabilities in solving systems of polynomial equations, however I regularly obtain errors of Singular not recognizing the ring, that is created when executing the solve() command from the solve.lib Singular package. It seems somehow random to me, because the error only appears at about 30% of the time running to programm, so just giving it another try (without making any changes to the code) results in the desired result most of the time.
Here is my code:
C.<x, y> = PolynomialRing(QQ)
f = x^2 +y^2
epsilon = 1
# suggested by "rburing" to my question 'Passing functions to Singular'
# because I need to split f=f1+i*f2 in real and imaginary part
S.<x_1,x_2,y_1,y_2,i> = PolynomialRing(QQ)
F = f.subs({x: x_1 + i*x_2, y: y_1 + i*y_2}).reduce([i^2+1])
f1, f2 = F.polynomial(i).coefficients()
R = singular.ring(0,'(x_1,x_2,y_1,y_2)', 'lp')
g1 = singular.new(str(f1))
g2 = singular.new(str(f2))
g3 = singular.new('x_1^2 + x_2^2 +y_1^2+y_2^2 -' + str(epsilon) + '^2')
# creating the first ideal
I = singular.ideal(g1, g2, g3)
singular.lib("primdec.lib")
singular.lib("solve.lib")
# obtain the simplified components of the solution
components = I.primdecGTZ()
k1_1 = components[1][2][1]
k1_2 = components[1][2][2]
k1_3 = components[1][2][3]
singular.setring(R)
# creating a new ideal containing only the first component
H = singular.ideal(str(k1_1),str(k1_2),str(k1_3))
singular.setring(R)
# I now add another constraint to get two real solutions
# sphere around a point close to the solution
J = singular.ideal(H, '(x_1-0)^2 + (x_2+985/1393)^2 +(y_1-985/1393)^2+(y_2-0)^2 -1/10^2')
T = singular.solve(J)
singular.setring(T)
print(singular.eval('SOL'))
It might seem complicated to create that many Ideals but it is necessary because some of them are needed more often.
Executing it 10 times results in 2 to 3 errors of the following kind:
SingularError Traceback (most recent call last)
<ipython-input-55-da8b511c4e72> in <module>()
28 J = singular.ideal(H, '(x_1-0)^2 + (x_2+985/1393)^2 +(y_1-985/1393)^2+(y_2-0)^2 -1/10^2')
29 T = singular.solve(J)
-> 30 singular.setring(T)
31 print(singular.eval('SOL'))
/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/interfaces/singular.py in set_ring(self, R)
1097 if not isinstance(R, SingularElement):
1098 raise TypeError("R must be a singular ring")
-> 1099 self.eval("setring %s; short=0"%R.name(), allow_semicolon=True)
1100
1101 setring = set_ring
/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/interfaces/singular.py in eval(self, x, allow_semicolon, strip, **kwds)
657 # Singular actually does use that string
658 if s.find("error occurred") != -1 or s.find("Segment fault") != -1:
-> 659 raise SingularError('Singular error:\n%s'%s)
660
661 if get_verbose() > 0:
SingularError: Singular error:
? sage2437 is no name of a ring/qring
? error occurred in or before STDIN line 746: `setring sage2437; short=0;
Thanks for your help! Greetings PaulPaulEbertMon, 06 Apr 2020 11:07:09 -0500https://ask.sagemath.org/question/50599/NumberField NotImplemented Errorhttps://ask.sagemath.org/question/50052/numberfield-notimplemented-error/Hello!
I am currently trying to use NumberFields but I am getting random errors when using them.
I am trying to construct a NumberField by using
K=NumberField(x^2 +x+ 1, 'y')
or
K.<y> = NumberField(x^2+x+1)
Sometimes it works out just fine and other times i just get this NotImplemented Error:
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute flags=compile_flags), namespace, locals)
File "", line 1, in <module>
File "sage/modules/free_module_element.pyx", line 2023, in sage.modules.free_module_element.FreeModuleElement.__pow__ (build/cythonized/sage/modules/free_module_element.c:14871)
raise NotImplementedError
NotImplementedError
And after that I can't make it work anymore.
I tried resetting variables but that doesn't seem to be the problem.
Does anybody might have an idea what causes this issue?
CheersErratisTue, 25 Feb 2020 05:54:32 -0600https://ask.sagemath.org/question/50052/Why does solve() produces an error?https://ask.sagemath.org/question/49699/why-does-solve-produces-an-error/Why does solve() produces an error? `TypeError: The first argument must be a symbolic expression or a list of symbolic expressions.`
#!/usr/bin/env python
# coding: utf-8
# In[2]:
var('Ex Ey Ez')
# In[3]:
E=vector([Ex,Ey,Ez])
# In[4]:
var('Px Py Pz')
# In[5]:
P=vector([Px,Py,Pz])
# In[6]:
var('LAx LAy LAz LBx LBy LBz')
# In[7]:
LA=vector([LAx,LAy,LAz]); LB=vector([LBx,LBy,LBz])
# In[8]:
var('k QAx QAy')
# In[9]:
QA=QAx*LA+QAy*LB
# In[20]:
solve(E-P==k*(E-QA), [k, QAx, QAy])
# In[24]:
solve((E-P).cross_product(E-QA)==0, [QAx, QAy])portonTue, 28 Jan 2020 02:02:13 -0600https://ask.sagemath.org/question/49699/Condition of type: STORAGE-EXHAUSTEDhttps://ask.sagemath.org/question/49077/condition-of-type-storage-exhausted/ While doing some long calculations I got the error:
> Condition of type: STORAGE-EXHAUSTED
What does it mean? How do I get rid of it?mattiavThu, 19 Dec 2019 00:29:19 -0600https://ask.sagemath.org/question/49077/Error: Tried to use Sage's Python which was not yet installed.https://ask.sagemath.org/question/48855/error-tried-to-use-sages-python-which-was-not-yet-installed/ I get the following error when I try to run Sage.
$ sage
Error: Tried to use Sage's Python which was not yet installed.
If this was called from an spkg-install script for another package you should add $(PYTHON) as a dependency in build/pkgs/<pkg>/dependencies
I am using MAC. I did install both Python2 and Python3. I also upgraded my python to latest versions using
$ brew upgrade python@3
$ brew upgrade python@2
I do not understand the problem. Please help me. pantherFri, 22 Nov 2019 12:59:09 -0600https://ask.sagemath.org/question/48855/using cplex as a solver in sage - import error undefined symbol: CPXsetlogfilehttps://ask.sagemath.org/question/46606/using-cplex-as-a-solver-in-sage-import-error-undefined-symbol-cpxsetlogfile/Hi,
Ubuntu 18.04; Installed cplex_studio129.linux-x86-64.bin and then Sage 8.7 from source.
I chose source to allow me to "make" Sage again after linking the necessary CPLEX files as described at the very bottom of the page here:
doc.sagemath.org/html/en/thematic_tutorials/linear_programming
i.e. from
/home/klara/sage-8.7/local/lib
`ln -s /opt/ibm/ILOG/CPLEX_Studio129/cplex/lib/x86-64_linux/static_pic/libcplex.a .`
and from:
/home/klara/sage-8.7/local/include
`ln -s /opt/ibm/ILOG/CPLEX_Studio129/cplex/include/ilcplex/cplex.h .`
and finally, also from:
/home/klara/sage-8.7/local/include
`ln -s /opt/ibm/ILOG/CPLEX_Studio129/cplex/include/ilcplex/cpxconst.h .`
But now I get the following import error when running:
sage: p = MixedIntegerLinearProgram(solver='CPLEX')
ImportError: /home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/cplex_backend.so: undefined symbol: CPXsetlogfile
(By the way, after installing Sage but before linking and remaking I got the more basic import error:
`ImportError: No module named cplex_backend`)
Any hints as what to look into would be appreciated.
Thanks.
----------
Here is the Full Output of the error:
sage: p = MixedIntegerLinearProgram(solver='CPLEX')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-d320ed52392f> in <module>()
----> 1 p = MixedIntegerLinearProgram(solver='CPLEX')
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3690)()
352 True
353 """
--> 354 return self.get_object()(*args, **kwds)
355
356 def __repr__(self):
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/mip.pyx in sage.numerical.mip.MixedIntegerLinearProgram.__init__ (build/cythonized/sage/numerical/mip.c:3931)()
449 self._first_variable_names = list(names)
450 from sage.numerical.backends.generic_backend import get_solver
--> 451 self._backend = get_solver(solver=solver,
452 constraint_generation=constraint_generation,
453 base_ring=base_ring)
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/generic_backend.pyx in sage.numerical.backends.generic_backend.get_solver (build/cythonized/sage/numerical/backends/generic_backend.c:20060)()
1647 raise ValueError("'solver' should be set to 'GLPK', 'Coin', 'CPLEX', 'CVXOPT', 'Gurobi', 'PPL', 'InteractiveLP', or None.")
1648
-> 1649 cpdef GenericBackend get_solver(constraint_generation = False, solver = None, base_ring = None):
1650 """
1651 Return a solver according to the given preferences
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/generic_backend.pyx in sage.numerical.backends.generic_backend.get_solver (build/cythonized/sage/numerical/backends/generic_backend.c:19611)()
1794
1795 elif solver == "Cplex":
-> 1796 from sage.numerical.backends.cplex_backend import CPLEXBackend
1797 return CPLEXBackend()
1798
ImportError: /home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/cplex_backend.so: undefined symbol: CPXsetlogfilebucks65Tue, 21 May 2019 06:36:42 -0500https://ask.sagemath.org/question/46606/Why do I get the OSError: [Errno2] when I try to run a .sage filehttps://ask.sagemath.org/question/46116/why-do-i-get-the-oserror-errno2-when-i-try-to-run-a-sage-file/Hello.
I'm new to SageMath and just installed it. Unfortunately I'm not too concerned with the importance of the information you might need to help me out - sorry for that.
So I have Windows 10 and I installed SageMath via These pre- built binaries if that's what it is called. I used the sagetex package to create a .sage file and I tried to run it with sage obviously. Therefore, I opened the Shell and typed
sage 'C:/Users/scheu/OneDrive/Desktop/sagetex.sage'
with sagetex.sage being my .sage file and I'm getting the following:
Traceback (most recent call last):
File "/opt/sagemath-8.6/src/bin/sage-preparse", line 245, in <module>
do_preparse(f)
File "/opt/sagemath-8.6/src/bin/sage-preparse", line 137, in do_preparse
with atomic_write(fname) as f:
File "/opt/sagemath-8.6/local/lib/python2.7/site-packages/sage/misc/temporary_file.py", line 422, in __enter__
fd, name = tempfile.mkstemp(dir=self.tmpdir)
File "/opt/sagemath-8.6/local/lib/python2.7/tempfile.py", line 314, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File "/opt/sagemath-8.6/local/lib/python2.7/tempfile.py", line 244, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 2] No such file or directory: '/home/sage/C:/Users/scheu/OneDrive/Desktop/Programme/LaTeX Files,Texmaker/Hilffiles/sagetex test/tmpfPP2mL'
By the way, I am sorry for putting the Code in my Question that way, I had just no idea how to Format this Code as one Code :(
Anyways, it says something I don't quite understand and I've already looked up the same Question, but it didn't help…
Thank you for your answers.LilanarusFri, 12 Apr 2019 14:44:50 -0500https://ask.sagemath.org/question/46116/Why does Sage Math crash instantly? / Running .sage files?https://ask.sagemath.org/question/46051/why-does-sage-math-crash-instantly-running-sage-files/ Hello.
First of all, I need to Mention that I am completely new to Sage Math and I have no idea what causes my problem(s), like seriousely, no idea.
When I start SageMath, it instantly crashes, I don't even touch anything. I'm running Windows 10 and I downloaded the binaries, a virtual box and this sage-8.6.tar.gz file. I am sure that I must be missing something but I don't know what.
Yesterday, I managed to get Sage to work, so in the terminal i could write simple commands like
sage:4+3
and later, I reinstalled python. Now it does not work anymore. My original aim was it to have sagetex in Latex, but for some reason running the .sage file which is created with every document using sagetex doesn't do anything and sage does not compile my document. And yes, I did follow the instructions how to make sagetex known to tex.
I have no idea how to continue, so many problems and i'm desperately trying to get things to work. (Feel like I downloaded half the Internet...) LilanarusMon, 08 Apr 2019 09:26:52 -0500https://ask.sagemath.org/question/46051/Wrong output by plotting with SageMath Version 8.4.rc1 (Trusted)https://ask.sagemath.org/question/45698/wrong-output-by-plotting-with-sagemath-version-84rc1-trusted/What is wrong? I got erroneous results by plots.
In: plot(sin(x))
Out: Graph - incorrect!
In: plot(bessel_J(0, x), x, -0, 1)
Out: Graph - incorrect!
I can send send you screenshots of both, but I don't how.myka32Thu, 07 Mar 2019 04:37:47 -0600https://ask.sagemath.org/question/45698/Error in false statementhttps://ask.sagemath.org/question/45623/error-in-false-statement/Hello
I write in SAGE the following
p=0+0*I
q=1/2+1/2*I
r=3/4+1/3*I
(real(p)==real(q))==false
and it returns "false", but it is true because 0 is not equal to 1/2. Why?creyesm1992Sun, 03 Mar 2019 10:10:55 -0600https://ask.sagemath.org/question/45623/Error in false statementhttps://ask.sagemath.org/question/45622/error-in-false-statement/I write in SAGE the following sentences
p=0+0*I
q=1/2+1/2*I
r=3/4+1/3*I
(real(p)==real(q))==false
As 0 is not equal to 1/2, this statement must be true, but SAGE says false. Why?creyesm1992Sun, 03 Mar 2019 10:09:17 -0600https://ask.sagemath.org/question/45622/__init__() takes exactly 5 arguments (4 given) error in contour plothttps://ask.sagemath.org/question/45446/__init__-takes-exactly-5-arguments-4-given-error-in-contour-plot/ I am trying to make a contour plot of a complex valued function. Let say it is g(z).
I have imported the complex root and ContourPlot command by doing following:
from sage.rings.polynomial.complex_roots import complex_roots
from sage.plot.contour_plot import ContourPlot
I have even successfully plot the 3d-Plot, but I encountered an error stating:
__init__() takes exactly 5 arguments (4 given)
My command is:
C=ContourPlot(lambda x,y:float(green(x+y*I)),(-5,5),(-5,5))
It seems that I did not miss the fifth argument, I tried to add in some commands, such as plot_points, but then Sage said it did not expect these commands..
What did I miss? Thank you!!JacobsonRadicalWed, 13 Feb 2019 05:03:37 -0600https://ask.sagemath.org/question/45446/How can I solve the following (linear) differential equation?https://ask.sagemath.org/question/45075/how-can-i-solve-the-following-linear-differential-equation/I want Sage to solve this equation:
$y'''-3y''+y'-5y=0$.
Both
y=function('y')(x)
desolve(diff(y,3)-3*diff(y,2)+diff(y,1)-5*y,y)
and
giac("desolve([y'''-3y''+y'-5y],y)").sage()
result in errors.ThrashWed, 16 Jan 2019 22:27:41 -0600https://ask.sagemath.org/question/45075/Why doesn't assume(x, 'real') exclude complex values when using plot(x^(1/3)) over a negative domain?https://ask.sagemath.org/question/44798/why-doesnt-assumex-real-exclude-complex-values-when-using-plotx13-over-a-negative-domain/ Running the following commands:
assume(x,'real')
plot(x^(1/3), -5, 5)
produces the following error:
verbose 0 (3630: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 100 points.
verbose 0 (3630: plot.py, generate_plot_points) Last error message: 'negative number cannot be raised to a fractional power'
Shouldn't the assume command take care of this?
Thanks.
douglas.y.youngThu, 27 Dec 2018 21:04:18 -0600https://ask.sagemath.org/question/44798/Error when running a commandhttps://ask.sagemath.org/question/43337/error-when-running-a-command/Why does sage say that there is an error when I type a command and run it? (even I run 1+1, the error appear)
Here is how sage says:
ERROR: 'closed'
Communication with the Sage server is failing.
Here are some actions you could try to resolve this problem:
- check your internet connection,
- run this cell again,
- close and reopen this file,
- restart the project (in project settings, wrench icon),
- reload the browser tab or even restart your browser,
- delete some of the content in the project's ~/.local directory,
(locally installed Python libraries might interfere with running this worksheet)
pizzaSat, 11 Aug 2018 09:48:34 -0500https://ask.sagemath.org/question/43337/Unable to build sage with Python 2https://ask.sagemath.org/question/42970/unable-to-build-sage-with-python-2/I set `export SAGE_CHECK="yes"` to run tests on the spkgs before running `make -j5`. This gives me another build breaking error, despite using python 2 to build sage
Sage version: 8.3rc0
OS fedora 28 linux_86_x64
### Last section from ppl-1.2.p1.log or see [pastebin](https://pastebin.com/vtJYjqLQ):
In file included from ../../src/Pointset_Powerset_defs.hh:1454,
from ../../src/algorithms.hh:28,
from ../../src/ppl_include_files.hh:18,
from ../../src/ppl_header.hh:38,
from ../../tests/ppl_test.hh:27,
from equals1.cc:25:
../../src/Pointset_Powerset_templates.hh: In instantiation of 'Parma_Polyhedra_Library::Pointset_Powerset<PSET>::Pointset_Powerset(const Parma_Polyhedra_Library::Pointset_Powerset<QH>&, Parma_Polyhedra_Library::Complexity_Class) [with QH = Parma_Polyhedra_Library::Box<Parma_Polyhedra_Library::Interval<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, Parma_Polyhedra_Library::Interval_Info_Bitset<unsigned int, Parma_Polyhedra_Library::Test::Rational_Real_Open_Interval_Info_Policy> > >; PSET = Parma_Polyhedra_Library::NNC_Polyhedron]':
../../src/Pointset_Powerset_inlines.hh:262:43: required from 'bool Parma_Polyhedra_Library::Pointset_Powerset<PSET>::geometrically_equals(const
Parma_Polyhedra_Library::Pointset_Powerset<PSET>&) const [with PSET =
Parma_Polyhedra_Library::Box<Parma_Polyhedra_Library::Interval<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, Parma_Polyhedra_Library::Interval_Info_Bitset<unsigned int, Parma_Polyhedra_Library::Test::Rational_Real_Open_Interval_Info_Policy> > >]'
equals1.cc:44:50: required from here
../../src/Pointset_Powerset_templates.hh:66:29: internal compiler error: in type_dependent_expression_p, at cp/pt.c:25100
y_end = y.end(); i != y_end; ++i) {
~~^~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccb8H3zx.out file, please attach this to your bugreport.
make[7]: *** [Makefile:1245: equals1.o] Error 1
************************************************************************
Error testing package ppl-1.2.p1
********
****************************************************************number123Thu, 12 Jul 2018 11:34:50 -0500https://ask.sagemath.org/question/42970/RuntimeWarning [Sage 8.2 WSL]https://ask.sagemath.org/question/42959/runtimewarning-sage-82-wsl/Hi. I was pretty surprised to see Sage linux binaries worked on WSL right away. There's just 1 problem, which is:
```
RuntimeWarning: 'sin' and 'sout' swap memory stats couldn't be determined and were set to 0
```
Is there a fix to this?o6pThu, 12 Jul 2018 08:33:23 -0500https://ask.sagemath.org/question/42959/Unable to compile sagehttps://ask.sagemath.org/question/42894/unable-to-compile-sage/I've spent more than an hour trying to create a google account so that I can report serious problems I'm having with compiling the sagemath source code but google won't let me create an account. Its very unreasonable for sagemath to require users to create a google account just to get support. Why not use github or an independent website? Just because they are closely tied with google doesn't mean they have to force users to bend to their will.
Any way, the problem is that I get this error when trying to build sagemath on fedora 28:
Error building Sage.
The following package(s) may have failed to build (not necessarily
during this run of 'make all-start'):
* package: ppl-1.2.p1
log file: /home/user/sagemath/src/logs/pkgs/ppl-1.2.p1.log
build directory: /home/user/sagemath/inst/var/tmp/sage/build/ppl-1.2.p1
* package: zeromq-4.0.5.p2
log file: /home/user/sagemath/src/logs/pkgs/zeromq-4.0.5.p2.log
build directory: /home/user/sagemath/inst/var/tmp/sage/build/zeromq-4.0.5.p2number123Tue, 10 Jul 2018 14:41:42 -0500https://ask.sagemath.org/question/42894/Ploting ODE (unable to simplify to float approximation)https://ask.sagemath.org/question/42487/ploting-ode-unable-to-simplify-to-float-approximation/I wanted to to draw the slope field aswell as the solution for my ODE.
When I try to plot the solution i get a warning and an error.
verbose 0 (3749: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points.
verbose 0 (3749: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'
My Code:
----------
y = function('y')(x)
a,b,c,d=var('a b c d')
_C=var('_C')
a=1
b=0
c=0
d=1
de = diff(y,x) == (a*x+b*y)/(c*x+d*y)
h = desolve(de, y, ivar=x);
h=h.substitute(_C==0)
h
y = var('y')
x = var('x')
Plot1=plot_slope_field(((a*x+b*y)/(c*x+d*y)),(x,-10,10),(y,-10,10))
Plot2=plot(h,(x,0,5))
Plot1+Plot2MarsupilamieSun, 03 Jun 2018 13:53:10 -0500https://ask.sagemath.org/question/42487/Sage wont solve simultaneous equationhttps://ask.sagemath.org/question/42174/sage-wont-solve-simultaneous-equation/I tried asking this question earlier, but my profile still says I have asked 0 questions. I have tried solving this problem in different ways, but this is the closest I have gotten;
var('a b c d e f g h i')
X=matrix(3,3,[[0,1,0],[0,0,1],[1,0,0]])
P=matrix(3,3,[[a,b,c],[d,e,f],[g,h,i]])
Pdagger=P.transpose()
Xdagger=X.transpose()
Q=X*Pdagger
B=Q.solve_left(X)
eqns=[]
xlist=[]
for i in range(0,3):
for j in range(0,3):
eqns.append(B[i][j])
xlist.append(X[i][j])
final=[]
for k in range(0,9):
final.append(eqns[k]==xlist[k])
show(final)
sol=solve(eqns,[a,b,c,d,e,f,g,h,i])
show(sol)
I know there is a solution to this problem, and it is the identity, $PXP^{\dagger}=X$.
But the output:
Error in lines 19-19
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1013, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/symbolic/relation.py", line 976, in solve
raise TypeError("%s is not a valid variable." % repr(i))
TypeError: 2 is not a valid variable.
There is also probably a much more efficient way of specifying the problem, but I don't understand why this wont work. I would like to extend this problem to larger matrices as well, so autonomy is welcomed. However, I would appreciate any advice just on getting this error fixed.PatrickLewisWed, 25 Apr 2018 18:23:53 -0500https://ask.sagemath.org/question/42174/how to find the syntax errorhttps://ask.sagemath.org/question/41435/how-to-find-the-syntax-error/ Hi
Here's a short code (copy-paste) that gets me syntax error
i=3
while i>0 :
print i, 'looping'
i=i-1
"<ipython-input-7-8e7eba3f21a0>", line 4
i=i-Integer(1)
I retyped it a second time; now it works, but I don't see any difference.
i=3
while i>0 :
print i, 'looping'
i=i-1
Retyping only the line 4 with the error won't help, retyping the previous lines or restarting the kernel won't help either.
It's like a phantom error florinThu, 08 Mar 2018 05:58:58 -0600https://ask.sagemath.org/question/41435/error with cosinushttps://ask.sagemath.org/question/41059/error-with-cosinus/ When I type "cos(8*pi/7)", Sage answers me
cos(1/7*pi)
wich is wrong. I exchanged with some people who had the correct answer "-cos(1/7*pi)". So I guess the problem is with my CPU or my configuration. But how to change that ?
ThankskarlusSat, 10 Feb 2018 13:32:04 -0600https://ask.sagemath.org/question/41059/line number of error in .sage filehttps://ask.sagemath.org/question/40891/line-number-of-error-in-sage-file/ When sage reports an error, it reports the line number of the `.py` file where the error occured. I am wondering if there is a way to configure sage so that it instead reports the line number of the code in the `.sage` file that ultimately generated that problematic line in the `.py` file.
This would be useful because it is the `.sage` file that I am actually editing.
This is theoretically possible: other languages and transpilers use sourcemaps to solve this same issue.ml9nnTue, 30 Jan 2018 16:47:45 -0600https://ask.sagemath.org/question/40891/notebook admin not workinghttps://ask.sagemath.org/question/40861/notebook-admin-not-working/Hello,
I have installed sagemath on debian (Stretch) with the debian package on 3 different computers.
When clicking on manage users 500: internal server error
and
raise BuildError(endpoint, values, method, self)
BuildError: Could not build url for endpoint 'users' with values ['reset']. Did you mean 'admin.users' instead?
I have no clue how to fix this or what it is due to...
maybe I need to configure notebook or use different options
Any idea ?
Thank-you,
b.
edited added debian release 9bb16Mon, 29 Jan 2018 11:37:30 -0600https://ask.sagemath.org/question/40861/Keys of a dictionaryhttps://ask.sagemath.org/question/40059/keys-of-a-dictionary/Hello guys, I have a piece of code to get a dictionary of preimages of a function. These look like this:
{[0.0]: [[0 0 0 0 0]], [1.27]: [[0 0 0 0 1]], [2.63]: [[1 1 1 0 0]], ..... , [5.619999999999999]: [[1 0 1 1 1]]}
if I look for `preimages.keys()`, I get the following:
[[0.0], [1.27], [2.63], ....... , [5.619999999999999]]
But when I try to get a particular preimage like `preimages[1.27]` I get an error
KeyError: 1.27000000000000
even though it is in a dictionary. Or if I try
preimages [[1.27]]
I get another error
TypeError: unhashable type: 'list'
Could someone please help to solve this ploblem ?XeniaSun, 10 Dec 2017 07:43:41 -0600https://ask.sagemath.org/question/40059/How is the proper form to calculate the propagation errorhttps://ask.sagemath.org/question/39618/how-is-the-proper-form-to-calculate-the-propagation-error/ Hello, my function is;
alpha = (i1.g2/(i2.g1)-1)/(t1-t2)
I will have to measure i1, i2, g1, g2, t1 and t2 them
How is the proper way to calculate the propagation error for alphaAndresThu, 16 Nov 2017 16:57:53 -0600https://ask.sagemath.org/question/39618/