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, 06 Nov 2021 23:20:55 +0100Sage problem - diff results in local version and https://sagecell.sagemath.org/https://ask.sagemath.org/question/59620/sage-problem-diff-results-in-local-version-and-httpssagecellsagemathorg/Hello
I have no idea what is doing wrong and why.
I have wriiten script in SAGE in https://sagecell.sagemath.org/ and result are ok.
but when I installed SAGE on my UBUNTU, the same script show wrong calculation.
I checked it on https://sagecell.sagemath.org/ and my version on UBUNTU.
any idea?MiroslawSat, 06 Nov 2021 23:20:55 +0100https://ask.sagemath.org/question/59620/Getting the intermediate steps while calculating grobner basis in sage?https://ask.sagemath.org/question/57282/getting-the-intermediate-steps-while-calculating-grobner-basis-in-sage/ I was trying to calculate the grobner basis using sage online compiler .I wanted to ask whether there is some command to see the intermediate steps while calculating the grobner basis ?
ThirstForSageWed, 26 May 2021 18:02:38 +0200https://ask.sagemath.org/question/57282/problem with float not equals but should be equals? problemhttps://ask.sagemath.org/question/57268/problem-with-float-not-equals-but-should-be-equals-problem/ Dear Collegues
I have a problem with checking equals float numbers:
code:
d = 0.2
u = d - 1
up = d - 0.5
r = u
for i in range(1,7):
r = r + 0.1
print(i,r,up)
if r == up :
print("equal","r",r,"=","up",up)
break;
output:
1 -0.700000000000000 -0.300000000000000
2 -0.600000000000000 -0.300000000000000
3 -0.500000000000000 -0.300000000000000
4 -0.400000000000000 -0.300000000000000
5 -0.300000000000000 -0.300000000000000
6 -0.200000000000000 -0.300000000000000
in line 5 -> it should print that are equals...
what is wrong?MiroslawTue, 25 May 2021 19:52:28 +0200https://ask.sagemath.org/question/57268/Which hash function can be used to get $w=H(d)\in F^n$ case?https://ask.sagemath.org/question/55408/which-hash-function-can-be-used-to-get-whdin-fn-case/I am trying to implement a cryptographic scheme. For a arbitrary message $d$ , I need a Hash Function $\mathbb{H}$ that can compute the hash value $w=\mathbb{H}(d)\in \mathbb{F}^n$. Here $F$ is a finite field of order four.
I can not find any hash function which outputs field values.
Can someone please help and show me the right direction?Sri1729Thu, 21 Jan 2021 11:50:33 +0100https://ask.sagemath.org/question/55408/Tracing a graph in sagemathhttps://ask.sagemath.org/question/50100/tracing-a-graph-in-sagemath/So far my journey into the math world, I have relied on TI-83 calculator a lot to make graphs (as well as trace them).
As far as I know, I can only plot a graph with sagemath. Is there any way to trace a graph?ggFri, 28 Feb 2020 11:38:53 +0100https://ask.sagemath.org/question/50100/Error in calling a custom function from sagehttps://ask.sagemath.org/question/50004/error-in-calling-a-custom-function-from-sage/I used [this](https://ask.sagemath.org/question/10723/manage-my-functions-in-sage/) guide to add module containing some utility to the sage.
My module (`myfunc.py`) looks like this:
def perm(n, r):
return factorial(n)/factorial(n-r)
def comb(n, r):
return perm(n, r)/factorial(r)
To import the module I use the following `import` statement:
sage: from myfunc import perm
So far so good.
When I call the `perm()` or `comb()` function. I get the following error:
1 def perm(n, r):
----> 2 return factorial(n)/factorial(n-r)
3
4 def comb(n, r):
5 return perm(n, r)/factorial(r)
NameError: name 'factorial' is not defined
ggThu, 20 Feb 2020 15:21:09 +0100https://ask.sagemath.org/question/50004/Default algorithm for cardinalityhttps://ask.sagemath.org/question/49070/default-algorithm-for-cardinality/Hello, I am using Sage for operations on elliptic curves and I was curious what is the default algorithm used to compute the cardinality of a curve when: "E.cardinality()" is used? I tried to find it here: http://doc.sagemath.org/html/en/reference/curves/sage/schemes/elliptic_curves/ell_finite_field.html but I only found out there are some algorithms which you can choose as an optional argument. Is it the Schoof's algorithm?JanoutVWed, 18 Dec 2019 20:00:15 +0100https://ask.sagemath.org/question/49070/Does sage offer API?https://ask.sagemath.org/question/49066/does-sage-offer-api/ Hello, I am currently using sage for calculations on elliptic curves in my semestral project and I want to build a sort of a "wrap GUI" in JavaFX, which would generate input for Sage and then will format the output from it. I was wondering if Sage offers some kind of API? I am well aware of using Processbuilder class in java to create and manage different processes, but this method inevitably has some caveats, so I'm just interested, is Sage offering some kind of API?JanoutVWed, 18 Dec 2019 13:45:19 +0100https://ask.sagemath.org/question/49066/how do i create my own project in sagemathhttps://ask.sagemath.org/question/48073/how-do-i-create-my-own-project-in-sagemath/ I 'm intersted in sagemath for encryption. However, i have not undertood how i can create my own project in this tool as in eclipse. How do I write my own algorithms as code file in this tool.ilkhyoThu, 26 Sep 2019 13:34:55 +0200https://ask.sagemath.org/question/48073/How i docreate my own projecthttps://ask.sagemath.org/question/48072/how-i-docreate-my-own-project/ I 'm intersted in sagemath for encryption. However, i have not undertood how i can create my own project in this tool as in eclipse. How do I write my own algorithms as code file in this tool.ilkhyoThu, 26 Sep 2019 13:33:48 +0200https://ask.sagemath.org/question/48072/Strict Avalanche Criteria in Sagehttps://ask.sagemath.org/question/43598/strict-avalanche-criteria-in-sage/ Is there any inbuilt functionality in sage to check if any S-Box satisfies Strict Avalanche Criterion or not?Cryptographer005Thu, 06 Sep 2018 10:06:30 +0200https://ask.sagemath.org/question/43598/How to find version number of CAS used by sagehttps://ask.sagemath.org/question/42617/how-to-find-version-number-of-cas-used-by-sage/Hello. sagemath newbie here.
When I type
r=integrate(sqrt(x),x,algorithm="sympy")
or
r=integrate(sqrt(x),x,algorithm="fricas")
or
r=integrate(sqrt(x),x,algorithm="maxima")
etc..
what command to use to find what version numbers of those CAS it is using? For Fricas, I just installed it, so I know it is 1.3.3-1, But in general, how does one ask sage to provide this information? Is there a command to use?
Will these be the same obtained on the bash command line when doing
$which maxima
$which fricas
If that is the case, then I can find the version numbers easily. But what about sympy? How do I know which sympy sage is using to make sure.
Thank you,
--NasserNasserSun, 17 Jun 2018 09:14:20 +0200https://ask.sagemath.org/question/42617/Import Sage Worksheetshttps://ask.sagemath.org/question/41924/import-sage-worksheets/ Hello, I'm looking to be able to modulate my code in the Sage Math cloud. I've done some research on the topic and it seems that one could use the `attach` syntax to bring in the methods from another worksheet. Unfortunately I get the following error when I try to attach the sagews 'test' which is in the same folder as the worksheet I'm working in.
`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 "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_salvus.py", line 3443, in attach
raise IOError('did not find file %r to attach' % fname)
IOError: did not find file 'test' to attach`
Can anyone help me with this issue?
Thanks,
Adam
ajmullinsMon, 09 Apr 2018 02:24:28 +0200https://ask.sagemath.org/question/41924/function created in python under sagehttps://ask.sagemath.org/question/41847/function-created-in-python-under-sage/ Below a function in python,
forget();var('n i');g(x)=sin(x)+tan(x);
def maderive(n):
for i in range(n):
g=g.diff()
return g
When I call this function
maderive(3)
It doesn't work, I've got an error .StuSat, 31 Mar 2018 19:34:18 +0200https://ask.sagemath.org/question/41847/How can i transformation this code in sage?https://ask.sagemath.org/question/39926/how-can-i-transformation-this-code-in-sage/ P1= ellipse((4,4),3,3, color='purple') + circle((3,5), 0.4) + circle((5,5), 0.4) + polygon([(5,3), (3,3), (4 ,0.999999999)])
P2= plot((x+1), -10, 10, color='white')
P= P1 + P2
P.show ()selinkirisSun, 03 Dec 2017 16:25:15 +0100https://ask.sagemath.org/question/39926/Suppress automatically generated Python files when running Sage scripthttps://ask.sagemath.org/question/38383/suppress-automatically-generated-python-files-when-running-sage-script/ Hello,
I'm curious if it is possible to stop Sage from automatically generating corresponding Python files. For instance, if I run a sage script `test.sage`, then after running `sage test.sage`, I'll get an automatically generated file called `test.sage.py`. Is there any way to suppress the generation of this file? I tried to take a look in the documentation, but I couldn't find anything.
Thanks again! Vincent RussoMon, 24 Jul 2017 20:44:17 +0200https://ask.sagemath.org/question/38383/find four positive integers a,b,c,d whose 5th powers sum to the 5th power of another integer e, i.e. find five integers a,b,c,d,e such that a^5+b^5+c^5+d^5=e^5.https://ask.sagemath.org/question/34730/find-four-positive-integers-abcd-whose-5th-powers-sum-to-the-5th-power-of-another-integer-e-ie-find-five-integers-abcde-such-that-a5b5c5d5e5/I am working on Sage Math online , on Windows 10
In 1769, Lenhard Euler conjectured that at least n nth powers are required to obtain a sum that is itself an nth power for n>2. Disprove Euler's conjecture by writing an appropriate function and using it to find four positive integers a,b,c,d whose 5th powers sum to the 5th power of another integer e, i.e. find five integers a,b,c,d,e such that a^5+b^5+c^5+d^5=e^5.
I have tried this, but it seems like not given me what I wanted it. By the way, I am not allow to use "IF" Statement at all.
def calculateValues():
sumoffourvalues = 0
for i in range(2,6):
#display each valueS
print (i)
#calculate each value its power
eachpower = pow(i,5)
#sum of power values of four elements
sumoffourvalues = sumoffourvalues + eachpower
print ("power of sumofforvalues",sumoffourvalues)
#calculating power of fifth element
fifthelementvalue = pow(6,5)
print ("power of fifthelementvalue ",fifthelementvalue)
#Consider like below this way
#a5+b5+c5+d5−e5=0
resultantvalue = sumoffourvalues -fifthelementvalue
print("resultant value is ",resultantvalue)
calculateValues()TalafhaMon, 05 Sep 2016 16:20:27 +0200https://ask.sagemath.org/question/34730/where is the SageMath "Demonstrations Project"?https://ask.sagemath.org/question/35347/where-is-the-sagemath-demonstrations-project/I am sure most of you are aware of the [Wolfram Demonstrations Project](http://demonstrations.wolfram.com/topics.html). If not, it’s a library of interactive models demonstrating different mathematical concepts. If you *buy* Mathematica you can edit and experiment with the code yourself. I find it really helpful to be able to investigate something in a interactive graph to understand the relationships in say an economic model, e.g. this example of a [basic supply and demand model](http://demonstrations.wolfram.com/BasicSupplyAndDemand/), this more intricate [Keynesian IS-LM Model](http://demonstrations.wolfram.com/TheKeynesianISLMModel/), or this model that allows you to [investigate income and substitution effects with different utility functions](http://demonstrations.wolfram.com/IncomeAndSubstitutionEffectsWithDifferentUtilityFunctions/).
Friendly people here at ask.sagemath have a couple of times answered my questions by posting code to http://sagecell.sagemath.org, which I really appreciate, e.g. this [visualization of logistic population growth](http://sagecell.sagemath.org/?q=uwecsj), but **is there a way to search for SageMath code examples or some library of interactive SageMath models demonstrating different mathematical concepts like the Wolfram Demonstrations Project?** I'm also interested to share projects myself.
I think something like a SageMath "Demonstrations Project" could be a great way to demonstrate the power of SageMath in an very accessible way, and possibly contribute to spreading the awareness of SageMath.etbWed, 02 Nov 2016 12:33:58 +0100https://ask.sagemath.org/question/35347/Concerning "bits of precision"https://ask.sagemath.org/question/36103/concerning-bits-of-precision/I am a newcomer to Sage. I learn Sage to compute Gröbner bases.
Concerning polynomial ring, if I type:
R = PolynomialRing(QQ, 't')
R
I get:
Univariate Polynomial Ring in t over Rational Field
But if I type:
R = PolynomialRing(RR, 't')
R
I get:
Univariate Polynomial Ring in t over Real Field with 53 bits of precision
What does "with 53 bits of precision" mean? If I don't know its meaning, will it matter when I compute Gröbner bases? I would appreciate any help with this situation.KarlTue, 27 Dec 2016 15:46:22 +0100https://ask.sagemath.org/question/36103/How to convert worksheet to pdf file?https://ask.sagemath.org/question/36023/how-to-convert-worksheet-to-pdf-file/ I'm trying to convert a worksheet to pdf file. I printed the worksheet in a specified file as a pdf file,but the place of headers changed a little,and some addresses added to to the top of the pages, how can I fix this?
Thank you in advance.M95Thu, 15 Dec 2016 10:32:01 +0100https://ask.sagemath.org/question/36023/Speed of computing using sage in different platforms: User experienceshttps://ask.sagemath.org/question/34126/speed-of-computing-using-sage-in-different-platforms-user-experiences/ I want to know from the users of sage, their feeling on handling computations using sage on different platforms. Actually I have a windows pc and sage works by virtual machine inside it. So the computations are very slow. I am trying to compute the ray class groups associated with number fields. But the problem is: Somehow using virtual machine Sage runs too slowly, it even takes time to enter the data by the keyboard.
So I am thinking to buy a computer on some other platform (Ubuntu or Apple macbooks) (within around 1000 euro ) so that I can make some computations in a reasonable speed. I like to have user experiences on this issue.gopalMon, 18 Jul 2016 16:07:59 +0200https://ask.sagemath.org/question/34126/Bug in sage solvehttps://ask.sagemath.org/question/33487/bug-in-sage-solve/ Sage raises an error when I try to solve the following:
`solve(a*exp(k*2) - n, a*exp(k*8)-m, a, k, solution_dict=True)`
What is the reason for this?
proySat, 21 May 2016 09:09:31 +0200https://ask.sagemath.org/question/33487/how can i set the sage server password through command linehttps://ask.sagemath.org/question/29374/how-can-i-set-the-sage-server-password-through-command-line/ I am writing an ansible playbook to automate installation of sage.
The playbook looks like this:
---
- hosts: localhost
remote_user: root
tasks:
- name : update system
apt : update_cache=yes
- name : install m4
apt : name=m4 state=present
- name : install build-essential
apt : name=build-essential state=present
- name : install gcc
apt : name=gcc state=present
- name : install gfortran
apt : name=gfortran state=present
- name : install libssl-dev
apt : name=libssl-dev state=present
- name : install python-software-properties
apt : name=python-software-properties state=present
- name : add sage ppa repo
apt_repository: repo='ppa:aims/sagemath'
- name : update system
apt : update_cache=yes
- name : install dvipng
apt : name=dvipng state=present
- name : install sage binary
apt : name=sagemath-upstream-binary state=present
- name : invoke create_sagenb script
command: /usr/bin/screen -d -m sudo /root/databases-and-datamining-iiith/python-scripts/create_sagenb -i -y
- name : invoke start_sage script
command: /usr/bin/screen -d -m sudo /root/databases-and-datamining-iiith/python-scripts/start_sage -i -y
Clearly, this playbook will not set the password for sage server and hence the sage service will not start.
Is there any way to set password from command line or to start sage service without password.apurvMon, 31 Aug 2015 11:48:41 +0200https://ask.sagemath.org/question/29374/How to save the worksheet to PC on windows &https://ask.sagemath.org/question/27065/how-to-save-the-worksheet-to-pc-on-windows/ How I can save my sage file to PC on windows 7 to share with others.madan26Tue, 09 Jun 2015 05:51:40 +0200https://ask.sagemath.org/question/27065/Cannot login into ask.sagemath and recovery does not work.https://ask.sagemath.org/question/26715/cannot-login-into-asksagemath-and-recovery-does-not-work/Hi,
I wanted to login today with OpenID with google and the website asked me to complete the registration. Blind as I was, I entered a new user name and therefore could't login into my old account. After some googling I couldn't even login into my new account. The old account was connected to an email adress which is not my google adress.
The problem now is, that the recovery function does not work for both accounts. Any ideas how to fix this problem? Thanks in advancetemp_userMon, 04 May 2015 18:04:16 +0200https://ask.sagemath.org/question/26715/Why is sage giving me wrong answers?https://ask.sagemath.org/question/26490/why-is-sage-giving-me-wrong-answers/ Let's say I want to multiply $(\frac{-1 - i \sqrt{3}}{2})(\frac{-1 + i \sqrt{3}}{2})$. Doing it by hand, we easily see that the answer is 1.
However, when I type
n(((-1 + sqrt(-3))/2)*((-1-sqrt(-3))/2))
in sage, I get
1 - 5.55111512312578 x 10^(-17)i
which is (of course) very close to 1...but its not exactly 1. Why is that? How do I fix this??ArtusSat, 11 Apr 2015 00:39:58 +0200https://ask.sagemath.org/question/26490/Save V12 fix corrupt fileshttps://ask.sagemath.org/question/25168/save-v12-fix-corrupt-files/I experienced an issue where Sage Pastel V12 stopped showing customer activity and reports, with an old backup with almost a month in between I've managed to find the corrupt Customer files and replace it with 5th Nov 2014 backup but it's not showing any data in activity from there onwards, till date.
How Can I get Sage to load the invoices till date?wingdumMon, 08 Dec 2014 15:26:03 +0100https://ask.sagemath.org/question/25168/ask.sage forbidden goagent vpn ip?https://ask.sagemath.org/question/24804/asksage-forbidden-goagent-vpn-ip/when I use goagent today,can sign gmail and youtube,but troube in sage.
I can see sagemath.org and sign in ask.sagemath.org by gmail,
but cannot sign in cloud.sagemath.com,always connecting(red),and below:
There was an unexpected error during sign in. Please try again later. Timeout after 30 seconds
and when I use cell.sagemath.org,can input code,but cannot get result,always waiting.
because VPN IP is Black list,sage forbidden it?
My IP address 107.178.200.199
Country United States (US)
Region California (CA)
City Mountain View
ZIP code 94043
Hostname 199.200.178.107.gae.googleusercontent.com → 107.178.200.199
IP range 107.178.192.0 - 107.178.255.255
ISP Google Cloud
Organization Google Cloud
DNS
74.125.183.152 United States
Black list Yes
(Illegal 3rd party exploits, including proxies, worms and trojan)
Proxy No
Time
zone America/Los_Angeles
local Thu Nov 6 2014 23:04:44 GMT-0800 (PST) Mismatch
system
Fri Nov 07 2014 15:07:01 GMT+0800 (中国标准时间)
Browser
Headers Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36 AppEngine-Google; (+http://code.google.com/appengine; appid: s~t6t6jik9) Mismatch
JavaScript Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
Language zh-CN,zh;q=0.8 | zh-CNcjshFri, 07 Nov 2014 08:14:35 +0100https://ask.sagemath.org/question/24804/Typesetting Simple Student Worksheet Question & need to defer computationhttps://ask.sagemath.org/question/24637/typesetting-simple-student-worksheet-question-need-to-defer-computation/ I have
eq1=2*(x+10)/5==3*(6-5*x)/7
the command
print latex(eq1)
simplifies the equation to $$\frac{2}{5} x + 4 = -\frac{15}{7} x + \frac{18}{7}$$
is there something like latex(eq1.hold()) that would produce
$$\frac{2(x+3)}{5}=\frac{3(6-5x)}{7}$$
edit:
I must apologize in advanced as my code may seem infantile but I am very new to this and trying to learn. That said, I was able to get something going but it seems to me there must be a million better ways to do this. Can you point me in the right direction to generalize this process and improve this code. Keep in mind the point of this is to write a student worksheet with problem sets and solutions. can be seen here [link text](https://sagecell.sagemath.org/?z=eJydUk2P2jAQvSPxHywXae18LeHrQJuVeqmE1ENBvREOXnDAlbFZ27Rmq_3vHQfYBKRKVS_O8ObNmzfDGIEKJNn-ecOQT05ThCqptSFGH9WGGKY2ek9oRE6pp7Gn9GO3s-EVVDjuvwrrZgSq6BQZ7o5GIZxlWYLjU_ZDC0VwD8fWGVKzCaM0BgRV2iCGhEKgiBMowCD6Lnhn51-VkABTXBFPn_qIS8sRwkqDLSaR1fLohFY2NGL2711QaBHU0X9JC7sIWCM9Rd_NkYf6WiCowwqLovmRGX6QbM0JFjhBWAiBW9gsYLPZDIOjuvEXBu_lL2CHg9GetJaPliwzO0topshGbIWzxYQ2k5xWUPkB5k1ei5_MEOzRCb1iWqPgej5fPviHVdbvdhbZJ_8E0DctT0rvBZMLobZkPg9kaSGzNIKk4yTNaQJRngzr7yDJx00Q-pkrGZB-nUqH16p0kqSDW3oYrD4ExZn5TFzrsnplWRm2_t0-BLfsr8ItlKXklSO3qbxOxbfgoAZ9WRqx3Tn6dic3rNNvPXzxYtmWt834y-Zga-9bDyaiul8c9CNPH4MQKHQ7_CWH-VsTSQv6BY5bkLFhq_xlAMx2P6AWRRu4EodABHok13sgQavEhPecHBVASH0E7-UY1ppXlVgLrhxcXE0aA2mUEngyGTg0s8dn64Q7Ok580acX8xPgjSOSP8LnzLxTOxO7nZ3bS5DLabdjd_oXhIMmHDbhqAnHTTihQeMPn4JaLg==&lang=sage)
ri = lambda x,y: floor(round(random()*(y-x)+x)); #random integer from x to y
ls = [ri(-5,-1),ri(1,3),ri(2,15),ri(2,15)];
rs = [ri(2,10),ri(-3,-1),ri(-6,-2),ri(2,15)];
def texLinearA(t): return "$\\frac{"+str(latex(t[0]))+"\\left("+str(latex(t[1]))+"+"+str(latex(t[2]))+"x\\right)}{"+str(latex(t[3]))+"}$";
def sageLinearA(t): x=var("x"); return t[0]*(t[1]+t[2]*x)/t[3];
eq1 = texLinearA(ls)+"="+texLinearA(rs);
eq2 = sageLinearA(ls)==sageLinearA(rs);
eq3 = eq2*lcm(ls[3],rs[3]);
eq4=eq3-x*eq3.rhs().coefficient(x);
eq5=eq4-(eq4.lhs()).substitute(x=0);
eq6=eq5*(1/eq5.lhs().coefficient(x));
html(eq1);
show(eq2);
show(eq3);
show(eq4);
show(eq5);userXMon, 27 Oct 2014 04:02:29 +0100https://ask.sagemath.org/question/24637/How do I use sage to plot this?https://ask.sagemath.org/question/24046/how-do-i-use-sage-to-plot-this/I want to visualize graph of y = k/x (k > 0). Assume k = 10, for this example.
I referred to basic command, but it's not giving me the graph as I want.
I want same scale on both axes (i.e. same length for y and x axes for 1 unit). Generally the y axis is automatically scaled, so that x pixels represent different units on y and x axes. I don't want that. I also want to have grid lines of unit squares.taninamdarMon, 08 Sep 2014 11:19:36 +0200https://ask.sagemath.org/question/24046/