[sage-support] factoring in Gaussian integers

2022-06-24 Thread Michael Beeson


The following seems fishy:

``

sage: K. = QuadraticField(-*1*) 
   

sage: K.factor(*13*)   
   

(Fractional ideal (-3*a - 2)) * (Fractional ideal (2*a + 3))

``

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/71469fc7-dcca-4540-bb2a-a6d421f8560an%40googlegroups.com.


[sage-support] something seems wrong here

2022-01-01 Thread Michael Beeson


sage: d = *6*

sage: p = d/*2*

sage: p

3

sage: is_prime(p)

False  #  Huh?!!  

sage: is_prime(*3*)

True

sage: p==*3*

True

This happens in version 8.7  and also in the current version (installed 
yesterday)


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/9cb13872-298c-4463-b27d-b77ea288bfedn%40googlegroups.com.


[sage-support] regulator

2021-12-26 Thread Michael Beeson
I want to compute the regulator of a real quadratic field Q(sqrt d)  to 
high precision,
accurately enough to compute the fundamental unit.  The default 
breaks at d = 331  where fundamental unit needs more than 53 bits (the 
precision of doubles).   The documentation says that Pari computes to a 
higher precision than 
SageMath.  Also somewhere it says that if you get a good enough 
approximation to the regulator, it's trivial to refine it to high accuracy. 
  It refers to "the tutorial"  without a link; I read the Pari-GP tutorials 
on algebraic number theory without finding any explanation of that remark. 
  So actually there are two questions here:  point me to an explanation of 
refining the computation of the regulator,  and secondly,  fix the 
following code 
so that it doesn't print "oops"  when d = 331.

gp.set_real_precision(256)  # doesn't seem to do anything

def check_unit(N):
for d in range(10,N):
if not is_squarefree(d):
continue
K. = QuadraticField(d)
G = K.unit_group()
[x,y] = G.gen(1).value()
x = abs(x) 
R = K.regulator(None)
twox = round(exp(R))
x2 = twox/2
y2 = round(twox/sqrt(d))/2
print(d,x,x2,y,y2,exp(R)/2)
if x != x2 or y != y2:
print("oops!")
return 
if norm_is_negative(x,d):
  print("norm is negative")

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/1775cda8-6650-4073-92ea-a5918f896631n%40googlegroups.com.


[sage-support] Re: log to the base 2

2020-07-18 Thread Michael Beeson
And also

sage: log(*2*,x)

log(2)/log(x)


which goes a long ways to explain the previous results.  So log(2,x) is not 
actually log to the base 2 of x.




On Saturday, July 18, 2020 at 11:45:06 AM UTC-7, Michael Beeson wrote:
>
> sage: n(log(*2*,*408*/*370*))
>
> 7.08999206263157
>
> sage: log(*2*,*2*)
>
> 1
>
> sage: *2*^*7*
>
> 128
>
> sage: n(log(*2*,*408.0*/*370*))
>
> 7.08999206263157
>
> sage: version()
>
> 'SageMath version 8.7, Release Date: 2019-03-23'
>
> sage: n(log(*2*,*1.001*))
>
> 693.493696416899
>
> sage:log(2,1)  gives an error instead of 0.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/be80ff3d-5a5f-4a0a-9b5f-e5c227976d7do%40googlegroups.com.


[sage-support] log to the base 2

2020-07-18 Thread Michael Beeson


sage: n(log(*2*,*408*/*370*))

7.08999206263157

sage: log(*2*,*2*)

1

sage: *2*^*7*

128

sage: n(log(*2*,*408.0*/*370*))

7.08999206263157

sage: version()

'SageMath version 8.7, Release Date: 2019-03-23'

sage: n(log(*2*,*1.001*))

693.493696416899

sage:log(2,1)  gives an error instead of 0.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/89cc7e10-6752-440e-9ed2-f4cf4b120089o%40googlegroups.com.


[sage-support] sagemath starting extremely slow under windows 10

2019-12-27 Thread Michael Schmitz
Hi,

on my new laptop sagemath needs more than a minute (sometimes 3-4 minutes) 
until I get the sage:-prompt. When entering notebook() it takes again more 
than a minute (and sometimes longer) until the notebook appears. The first 
task (even things like 3+4) needs also an unuusal long time. After that 
sage is working properly. Using the Jupyter Notebook I have similar 
problems. It is starting extremely slow and the first task is done very 
slowly.

I am using
SageMath version 8.9, Release Date: 2019-09-29
I am working on an Lenovo ThinkPad X1 Carbon 2019 with Windows 10 
Professional
My CPU is Intel Core i7-8565U CPU @ 1.80 GHz 1.99 GHz

I have already tried to change to an older version of sagemath but it 
showed the same behaviour.

I am happy about any suggestions! Thanks
Michael

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/d5556735-d8ea-43bb-bd27-1f2114e940da%40googlegroups.com.


Re: [sage-support] Re: Sage Crash Report: Missing symbols in conda build for macOS?

2019-11-19 Thread Michael Boyle
That works!  Similarly

conda install -n sage "pynac=0.7.26=py36ha01bd41_0"

works for my python 3.6 attempt.  I see that you've already opened an issue 
on pynac-feedstock, so I'll leave you to it.

Thanks very much for you help!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/b6a93fe7-3a1d-4b36-9af8-91e01f55d714%40googlegroups.com.


[sage-support] Re: Sage Crash Report: Missing symbols in conda build for macOS?

2019-11-19 Thread Michael Boyle
Sure.  Here it is:

> conda list
# packages in environment at 
/Users/myusername/.continuum/miniconda3.7/envs/sage27:
#
# NameVersion   Build  Channel
_r-mutex  1.0.1   anacondar_1conda-forge
alabaster 0.7.12 py_0conda-forge
appdirs   1.4.3  py_1conda-forge
appnope   0.1.0 py27_1000conda-forge
arb   2.16.0h3aece09_1000conda-forge
attrs 19.3.0 py_0conda-forge
automat   0.8.0  py_0conda-forge
babel 2.7.0  py_0conda-forge
backports 1.0py_2conda-forge
backports.functools_lru_cache 1.6.1  py_0conda-forge
backports.os  0.1.1 py27_1001conda-forge
backports.shutil_get_terminal_size 1.0.0  py_3
conda-forge
backports_abc 0.5py_1conda-forge
bdw-gc8.0.4ha1b3eb9_0conda-forge
bleach3.1.0  py_0conda-forge
brial 1.2.5  py_1conda-forge
bwidget   1.9.130conda-forge
bzip2 1.0.8h01d97ff_1conda-forge
ca-certificates   2019.9.11hecc5488_0conda-forge
cairo 1.16.0he1c11cd_1002conda-forge
cctools   921  h5ba7a2e_4conda-forge
cddlib1!0.94j   h65ac59c_1001conda-forge
certifi   2019.9.11py27_0conda-forge
cffi  1.13.2   py27h33e799b_0conda-forge
chardet   3.0.4 py27_1003conda-forge
clang 9.0.0   default_hf57f61e_4conda-forge
clang_osx-64  9.0.0h22b1bf0_3conda-forge
clangxx   9.0.0   default_hf57f61e_4conda-forge
clangxx_osx-649.0.0h22b1bf0_3conda-forge
click 7.0py_0conda-forge
cliquer   1.21  h1de35cc_1000conda-forge
compiler-rt   9.0.0h2b4a0d1_1conda-forge
configparser  3.7.3py27_1conda-forge
constantly15.1.0 py_0conda-forge
contextlib2   0.6.0.post1py_0conda-forge
cryptography  2.8  py27hafa8578_0conda-forge
curl  7.65.3   h22ea746_0conda-forge
cvxopt1.2.3   py27h43946de_203conda-forge
cycler0.10.0 py_2conda-forge
cypari2   2.1.1py27h7c56200_0conda-forge
cysignals 1.10.2   py27hba7914e_1conda-forge
cython0.29.14  py27h4a8c4bd_0conda-forge
decorator 4.4.1  py_0conda-forge
defusedxml0.6.0  py_0conda-forge
docutils  0.15.2   py27_0conda-forge
dsdp  5.8   h7674d01_1203conda-forge
ecl   16.1.2h0672242_1004conda-forge
eclib 20190226 he5f4af6_2conda-forge
ecm   7.0.4 h65ac59c_1002conda-forge
entrypoints   0.3   py27_1000conda-forge
enum341.1.6 py27_1002conda-forge
expat 2.2.5 h4a8c4bd_1004conda-forge
fastcache 1.1.0py27h0b31af3_0conda-forge
fflas-ffpack  2.4.3h75e9206_1conda-forge
fftw  3.3.8   nompi_h44ae4c8_1110conda-forge
flask 0.11.1 py_1conda-forge
flask-autoindex   0.6.2  py_0conda-forge
flask-babel   0.12.2 py_0conda-forge
flask-oldsessions 0.10   py_0conda-forge
flask-openid  1.2.5 py27_1003conda-forge
flask-silk0.2py_0conda-forge
flintqs   1.0   hc269f14_1000conda-forge
fontconfig2.13.1h6b1039f_1001conda-forge
fplll 5.2.1 hc88034f_1000conda-forge
fpylll0.4.1devpy27heb9bef1_1000conda-forge
freetype  2.10.0

[sage-support] Sage Crash Report: Missing symbols in conda build for macOS?

2019-11-19 Thread Michael Boyle
I followed the installation instructions for conda 
 with both
python=3.6 (the most recent version that could install sage without
conflicts) and then python=2.7 (the one specifically cited in the
instructions) on macOS 10.13.6, using miniconda3.7.  Both complete
installation happily, but sage immediately dies in both environment.s
I have never used Sage before, so I have no Sage configuration, and I had
no input history during the session because I literally just typed `sage`
on the command line and it failed.  I use conda frequently, and don't 
usually
have problems, so I doubt that it's anything very specific to my setup.

Both 3.6 and 2.7 fail in the same way: there's a missing symbol from some
dylib.  The symbol is

__ZNSt3__16vectorIN5GiNaC2exENS_9allocatorIS2_EEE10deallocateEv

which demangles to

std::__1::vector 
>::deallocate()

So I guess that's not getting included in lib, somehow.  The full report
for 2.7 is attached — though the 3.6 report is essentially identical.

I've searched through every dylib that conda installs in envs/sage/lib, and
the only similar symbol I find is

__ZNSt3__16vectorIN5GiNaC2exENS_9allocatorIS2_EEE13__vdeallocateEv

which is in libpynac.dylib -> libpynac.18.dylib, and demangles to

std::__1::vector 
>::__vdeallocate()

I wonder if it's related to https://github.com/pynac/pynac/issues/239.

I appreciate any help you can give me.  Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/4bc2fcb7-7398-402e-be7f-e948f6efb31f%40googlegroups.com.
***

IPython post-mortem report

{'commit_hash': u'033ab93c7',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': 
'/Users/myusername/.continuum/miniconda3.7/envs/sage27/lib/python2.7/site-packages/IPython',
 'ipython_version': '5.8.0',
 'os_name': 'posix',
 'platform': 'Darwin-17.7.0-x86_64-i386-64bit',
 'sys_executable': 
'/Users/myusername/.continuum/miniconda3.7/envs/sage27/bin/sage-python23',
 'sys_platform': 'darwin',
 'sys_version': '2.7.15 | packaged by conda-forge | (default, Jul  2 2019, 
00:42:22) \n[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]'}

***



***

Crash traceback:

---
---
ImportErrorPython 2.7.15: 
/Users/myusername/.continuum/miniconda3.7/envs/sage27/bin/sage-python23
   Tue Nov 19 10:34:11 2019
A problem occurred executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/Users/myusername/.continuum/miniconda3.7/envs/sage27/bin/sage-ipython in 
()
  1 #!/usr/bin/env sage-python23
  2 # -*- coding: utf-8 -*-
  3 """
  4 Sage IPython startup script.
  5 """
  6 
  7 # Display startup banner. Do this before anything else to give the user
  8 # early feedback that Sage is starting.
  9 from sage.misc.banner import banner
 10 banner()
 11 
 12 from sage.repl.interpreter import SageTerminalApp
 13 
 14 app = SageTerminalApp.instance()
---> 15 app.initialize()
global app.initialize = >
 16 app.start()


 in initialize(self=, argv=None)

/Users/myusername/.continuum/miniconda3.7/envs/sage27/lib/python2.7/site-packages/traitlets/config/application.pyc
 in catch_config_error(method=, 
app=, *args=(None,), **kwargs={})
 72 TRAITLETS_APPLICATION_RAISE_CONFIG_FILE_ERROR = False
 73 else:
 74 raise ValueError("Unsupported value for environment variable: 
'TRAITLETS_APPLICATION_RAISE_CONFIG_FILE_ERROR' is set to '%s' which is none of 
 {'0', '1', 'false', 'true', ''}."% _envvar )
 75 
 76 
 77 @decorator
 78 def catch_config_error(method, app, *args, **kwargs):
 79 """Method decorator for catching invalid config 
(Trait/ArgumentErrors) during init.
 80 
 81 On a TraitError (generally caused by bad config), this will print 
the trait's
 82 message, and exit the app.
 83 
 84 For use on init methods, to prevent invoking excepthook on invalid 
input.
 85 """
 86 try:
---> 87 return method(app, *args, **kwargs)
method = 
app = 
args = (None,)
kwargs = {}
 88 except (TraitError, ArgumentError) as e:
 89 app.print_help()
 90 app.log.fatal("Bad 

[sage-support] compute regulator of quadratic field

2019-07-24 Thread Michael Beeson
SageMath has built-in functions to compute the regulator and the 
fundamental unit of a quadratic field.  The regulator of a quadratic field 
is the log of the absolute value of the fundamental unit.
So,  the following code should print out the same number on each line. 
 But, as you can check,  it does so only some of the time.  Try 
checkRegulator(30)  for example.I am using version 8.7.
I also wrote other code (not included here)  based on the Dedekind zeta 
function  to compute the regulator.  It agrees with SageMath's "regulator" 
function  rather than with log of the fundamental unit.

def checkRegulator(N):
for d in range(3,N):
if not is_squarefree(d):
continue
K. = QuadraticField(d)
G = K.unit_group()
u = G.gen(1).value();
Rdirect = abs(n(log(u)))
RSage = K.regulator()
print(d,RSage,Rdirect)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/e0dfaf5a-d0d8-4ab1-acb8-595946c5f743%40googlegroups.com.


[sage-support] Re: simplification options

2019-03-11 Thread Michael Beeson
 I appreciate Eric's post,  and I do use subs  sometimes,  but it makes me 
nervous since
it will happily substitute any old thing you tell it to,  even an incorrect 
thing.  So,  if your idea
is to check a computation, it is a dangerous thing.  True,  if you put only 
correct equations in, 
you'll usually get correct ones out.  

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] simplification options

2019-03-11 Thread Michael Beeson
In the following example  I would like to make Sage realize that  (p,q,r) 
are constants and (a,b) are variables
so in the end everything should be expressed as a polynomial in a,b.   In 
particular b^2 should be rewritten as 1-a^2
(b and a are actually sin and cosine of something)  but b should not be 
rewritten as sqrt(1-a^2).   And, 
in the end the terms should be grouped so we see explicitly the 
coefficients of a,b,1, and a^2.  Of course this
example is simple enough to do by hand,  but I want to know how to control 
Sage enough to get this to happen in Sage.
I tried various simplification functions.I suppose I could start over, 
 not using "symbolic expressions" but 
declaring K to be a suitable field or ring, maybe a quadratic extension of 
the field of rational functions in a. 
That is probably the "right" way to do it.   But I wish there were a 
simpler way.   I'm writing a paper with 
little snippets of Sage code with which the reader, who will be a 
mathematician probably unfamiliar with SageMath,
can check the computations, or see how the computations can be checked.
  So the code should be readable to such a person,  ruling out the 
introduction
of new fields.The code below is perfectly readable in that sense,  but 
it doesn't quite do the job.

def mar11b():
var('p,q,r,a,b')
b = sqrt(1-a^2)
lam = p*a + r*b + q
mu = r*a - p*b
lam = sqrt(N/2)
eq = lam^2 - (p*a+r*b+q)^2
eq = eq.expand()
print(eq)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: solution of a 4th degree equation is real despite containing I but causes trouble

2019-02-20 Thread Michael Beeson
Oh,  and  range(0,n(t))  also crashes.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] solution of a 4th degree equation is real despite containing I but causes trouble

2019-02-20 Thread Michael Beeson
The solution of a cubic or quartic may require the use of complex numbers. 
(Indeed that's how the complex numbers were first discovered.)
Below I exhibit a long expression for such a number that solve() found for 
me.
It evaluates using n(t) to a real (decimal) number,  and it passes " t in 
RR" 
although that takes five minutes and turns the fan of my laptop on (a sign 
of
serious CPU use).  Then I enter this number in range(0,t), which should be 
OK 
if t is real,  but it causes the same crash that range(0,I) causes, 
 complaining that 
t is complex.   Below is the code  (Sage version is 8.0--I plan to update 
Real Soon Now).
Well, so you may wonder "what is the actual question"?  It is,  how can I 
get my 
hands on this number in a form that I can actually put into range?   I want 
to bound 
a search by the size of the solution of a quartic and could not manage it 
because of 
this problem.



def test():
t =  -2/3*((sqrt(3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 
1328/3375)^(2/3) + 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 
364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 
45*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) - 
704/225*sqrt(3)/sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + 
552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 
364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 
364/675/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) + 6)^2 - 
90*sqrt(3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + 
552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 
364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) + 
4050*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) - 
704/225*sqrt(3)/sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + 
552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 
364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 
364/675/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) - 
4590)/((sqrt(3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + 
552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 
364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 
45*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) - 
704/225*sqrt(3)/sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + 
552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 
364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 
364/675/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) + 
6)*(sqrt(1/3)*sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) + 
552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 
364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 
15*sqrt(-(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) - 
704/75*sqrt(1/3)/sqrt((675*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(2/3) 
+ 552*(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 
364)/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3)) - 
364/675/(88/30375*I*sqrt(79)*sqrt(3) + 1328/3375)^(1/3) + 368/225) + 2)) + 
0.0100 
print(n(t))
print(t in RR)
print(range(0,t))

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] trig simplify disappointed me

2019-02-20 Thread Michael Beeson


sage: t

tan(1/2*arctan(12/5))

sage: t.trig_simplify()

sin(1/2*arctan(12/5))/cos(1/2*arctan(12/5))

sage: n(t)

0.667


But trig_simplify  couldn't get 2/3.  Maybe there

is a fancier command that will do it?

  

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: solve() behavior

2019-02-20 Thread Michael Beeson
after solving an equation (or not) for x,  I can check if the answer still 
contains x  by  ans.has(x).
That should weed out any non-explicit solutions.

But still:  am I guaranteed for any class of equations, e.g. polynomial 
equations of degree <= 4, 
that if solve produces an empty list there really are no solutions?  (I 
mean of course,  am I
guaranteed that if there are no bugs,  this is true?)




>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: solve() behavior

2019-02-19 Thread Michael Beeson
When I try to reproduce Eric's post,  I get an error message about an 
unexpected keyword argument 
(maybe my version of Sage is too old.)   But look at this:

sage: solve(*2**(x+sqrt(*1*-x^*2*))-*7*,x,explicit_solutions=True)

[1/4*I*sqrt(41) + 7/4 == -1/2*sqrt(7/2*I*sqrt(41) + 2), 1/4*I*sqrt(41) + 
7/4 == 1/2*sqrt(7/2*I*sqrt(41) + 2)]


That doesn't look like an "explicit solution" to me.   

How can I force solve to return only actual solutions, i.e.  x =  something 
not containing x?


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: solve() behavior

2019-02-18 Thread Michael Beeson
Eric's post shows me how to get that particular example solved.  But my 
real 
concern is,  when my code (inside some deep loop) calls solve,  I want to 
know 
(a)  if it returns an answer,  that answer really is a solution, and (b) if 
it 
returns an empty list,  there really is no solution.   

So  this example shows that (a) is sometimes false.  And when is (b) true?


On Monday, February 18, 2019 at 12:56:56 PM UTC-8, Michael Beeson wrote:
>
> sage: solve(*2**(x+sqrt(*1*-x^*2*))-*7*,x)
>
> [x == -sqrt(-x^2 + 1) + 7/2]
>
>
> sage: version()
>
> 'SageMath version 8.0, Release Date: 2017-07-21'
>
>
> That doesn't look like a solution to me because x still appears on the 
> right. 
>
> Is this the intended behavior?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] solve() behavior

2019-02-18 Thread Michael Beeson


sage: solve(*2**(x+sqrt(*1*-x^*2*))-*7*,x)

[x == -sqrt(-x^2 + 1) + 7/2]


sage: version()

'SageMath version 8.0, Release Date: 2017-07-21'


That doesn't look like a solution to me because x still appears on the 
right. 

Is this the intended behavior?



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: please explain casting in this example

2019-02-15 Thread Michael Beeson
Well,  the real cure is to use IntegerRange instead of range. 
Sorry to bother those of you who actually can read a manual.


On Friday, February 15, 2019 at 2:56:14 PM UTC-8, Michael Beeson wrote:
>
> def test(p,q):
> t = p/q;
> print(p,q,p/q,t)
> def test2():
> for p in range(1,4):
> for q in range(1,4):
> test(p,q)
>
> sage: test2()
>
> (1, 1, 1, 1)
>
> (1, 2, 0, 0)
>
> (1, 3, 0, 0)
>
> (2, 1, 2, 2)
>
> (2, 2, 1, 1)
>
> (2, 3, 0, 0)
>
> (3, 1, 3, 3)
>
> (3, 2, 1, 1)
>
> (3, 3, 1, 1)
>
> sage: test(*2*,*3*)
>
> (2, 3, 2/3, 2/3)
>
> sage: version()
>
> 'SageMath version 8.0, Release Date: 2017-07-21'
>
>
> When test(2,3) is executed at top-level, 2/3 is not cast to an integer. 
>  But when 
>
> it is executed inside test2,  2/3 becomes 0.  Why?  and how to prevent it?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: please explain casting in this example

2019-02-15 Thread Michael Beeson
And it can be fixed by inserting

p = sage.rings.integer.Integer(p)

after p is generated by range.  

Comments on this still welcome.  This may be a dumb question but
now I'm worried that perhaps this problem exists silently elsewhere in my 
code.


On Friday, February 15, 2019 at 2:56:14 PM UTC-8, Michael Beeson wrote:
>
> def test(p,q):
> t = p/q;
> print(p,q,p/q,t)
> def test2():
> for p in range(1,4):
> for q in range(1,4):
> test(p,q)
>
> sage: test2()
>
> (1, 1, 1, 1)
>
> (1, 2, 0, 0)
>
> (1, 3, 0, 0)
>
> (2, 1, 2, 2)
>
> (2, 2, 1, 1)
>
> (2, 3, 0, 0)
>
> (3, 1, 3, 3)
>
> (3, 2, 1, 1)
>
> (3, 3, 1, 1)
>
> sage: test(*2*,*3*)
>
> (2, 3, 2/3, 2/3)
>
> sage: version()
>
> 'SageMath version 8.0, Release Date: 2017-07-21'
>
>
> When test(2,3) is executed at top-level, 2/3 is not cast to an integer. 
>  But when 
>
> it is executed inside test2,  2/3 becomes 0.  Why?  and how to prevent it?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: please explain casting in this example

2019-02-15 Thread Michael Beeson
I see by inserting print(type(p))  that range produces objects of type int, 
 while when it's called from top-level the types of p and q are 
sage.rings.integer.Integer. 
So that answers "why"  but not "how to prevent".  

On Friday, February 15, 2019 at 2:56:14 PM UTC-8, Michael Beeson wrote:
>
> def test(p,q):
> t = p/q;
> print(p,q,p/q,t)
> def test2():
> for p in range(1,4):
> for q in range(1,4):
> test(p,q)
>
> sage: test2()
>
> (1, 1, 1, 1)
>
> (1, 2, 0, 0)
>
> (1, 3, 0, 0)
>
> (2, 1, 2, 2)
>
> (2, 2, 1, 1)
>
> (2, 3, 0, 0)
>
> (3, 1, 3, 3)
>
> (3, 2, 1, 1)
>
> (3, 3, 1, 1)
>
> sage: test(*2*,*3*)
>
> (2, 3, 2/3, 2/3)
>
> sage: version()
>
> 'SageMath version 8.0, Release Date: 2017-07-21'
>
>
> When test(2,3) is executed at top-level, 2/3 is not cast to an integer. 
>  But when 
>
> it is executed inside test2,  2/3 becomes 0.  Why?  and how to prevent it?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] please explain casting in this example

2019-02-15 Thread Michael Beeson
def test(p,q):
t = p/q;
print(p,q,p/q,t)
def test2():
for p in range(1,4):
for q in range(1,4):
test(p,q)

sage: test2()

(1, 1, 1, 1)

(1, 2, 0, 0)

(1, 3, 0, 0)

(2, 1, 2, 2)

(2, 2, 1, 1)

(2, 3, 0, 0)

(3, 1, 3, 3)

(3, 2, 1, 1)

(3, 3, 1, 1)

sage: test(*2*,*3*)

(2, 3, 2/3, 2/3)

sage: version()

'SageMath version 8.0, Release Date: 2017-07-21'


When test(2,3) is executed at top-level, 2/3 is not cast to an integer. 
 But when 

it is executed inside test2,  2/3 becomes 0.  Why?  and how to prevent it?



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: documentation?

2018-11-16 Thread Michael Beeson
Thank you, that was very instructive to see the "right way"  to start by 
using an appropriate ring. 
I guess you can go on to divide out by the other linear factor and get the 
quadratic equation, 
and solve it,  but I got that far myself, and then could not work with the 
solutions of the quadratic equation.
But you may be able to do that because then they will belong to some 
algebraic number field which 
will come equipped with useful algorithms.  

On Thursday, November 15, 2018 at 9:47:24 AM UTC-8, slelievre wrote:
>
> For the problem at hand here, I would work with polynomials in `x`
> with coefficients in the ring of polynomials in `N` and `M` over
> the field of algebraic numbers, and do something like the following.
>
> Define the ring of polynomials over the field of algebraic numbers.
>
> sage: R. = QQbar[]
>
> Define the ring of polynomials over the above polynomial ring.
>
> sage: S. = R[]
>
> Define `a`, `i`, `b`, `c`, `X`, `f` from the question.
>
> sage: a = QQbar(3).sqrt() / 2
> sage: i = QQbar(I)
> sage: b = (x - ~x) / (2 * i)
> sage: c = (a * (x + ~x) + b) / 2
> sage: X = (M / 3) * (a + b + c)
> sage: f = 24 * (X^2 - N * b * c) * x^2
>
> Note that the definition of `b` involves the inverse of `x` (which can be
> denoted by `~x` or `x^-1`) and therefore lives in the fraction field of 
> `S`,
> rather than in `S` itself. Therefore, so do `c`, `X`, and `f`.
>
> Check if `f` however represents an element in `S` as follows:
>
> sage: f in S
> True
>
> and then construct the corresponding element of `S` (we could call it `f`
> but here we call it `ff`).
>
> sage: ff = S(f)
>
> Check that `ff` vanishes at `-1`, or equivalently is divisible by `x + 1`.
>
> sage: ff(-1)
> 0
> sage: d = x + 1
> sage: d.divides(ff)
> True
>
> Perform exact division (to stay in the polynomial ring `S` rather than move
> to its fraction field).
>
> sage: g = ff // d
>
> Define `t` as an algebraic number.
>
> sage: t = QQbar(exp(-pi*I/3))
>
> Check that `g` vanishes at `t` or equivalently is divisible by `x - t`.
>
> sage: g(t)
> 0
> sage: dd = x - t
> sage: dd.divides(g)
> True
>
> Perform exact division.
>
> sage: h = g // dd
>
> Inspect the result:
>
> sage: h
> ((-1.000? - 1.732050807568878?*I)*M^2
>  + (3.000? + 5.196152422706632?*I)*N)*x^2
>  + ((1.000? - 1.732050807568878?*I)*M^2
>  + (3.000? - 5.196152422706632?*I)*N)*x
>  + 2*M^2 + (-6)*N
>
> Or as a list (the list of coefficients of `x^j`, for `j` from `0` to the 
> degree):
>
> sage: h.list()
> [2*M^2 + (-6)*N,
>  (1.000? - 1.732050807568878?*I)*M^2
>  + (3.000? - 5.196152422706632?*I)*N,
>  (-1.000? - 1.732050807568878?*I)*M^2
>  + (3.000? + 5.196152422706632?*I)*N]
>
> Define somme pretty_print functions to inspect these algebraic numbers:
>
> def pretty_print_qqbar(z):
> a, b = z.real().radical_expression(), z.imag().radical_expression()
> return "{} + {}*i".format(a, b)
>
> def pretty_print_x_coeff(xc):
> return " + ".join("({})*{}".format(pretty_print_qqbar(xc[m]), m)
>   for m in xc.monomials())
>
> and print `h` in a nice form:
>
> print("h =   " +
>   "\n+ ".join("({})*x^{}".format(pretty_print_x_coeff(xc), k)
>  for k, xc in enumerate(g.list(
>
> The result is:
>
> h =   ((-1 + sqrt(3)*i)*M^2 + (3 + -3*sqrt(3)*i)*N)*x^0
> + ((3 + sqrt(3)*i)*M^2 + (-3 + 3*sqrt(3)*i)*N)*x^1
> + ((3 + -sqrt(3)*i)*M^2 + (-3 + -3*sqrt(3)*i)*N)*x^2
> + ((-1 + -sqrt(3)*i)*M^2 + (3 + 3*sqrt(3)*i)*N)*x^3
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] documentation?

2018-11-14 Thread Michael Beeson
After quite some searching I did not succeed to find documentation for sage 
functions to work with complex numbers as much as I would like. 
For example  if I have a complicated rational expression,  how can I tell 
Sage "bring this to the form a + bi".  It seems real() and imag()  only 
work
if no pre-processing is needed.   How about "multiply numerator and 
denominator by denominator.conjugate()" ?  There's probably a chapter in 
the documentation about this,  could someone please point me to it,  I seem 
to be incompetent at finding it, sorry.  

Since people want something concrete to look at, not just a general 
question,  here is some code.   You'll see that it computes a certain 
complex function (actually two of them)
with integer parameters N and M,  the solution(s) of a certain equation.   
I'd like to compute that the absolute value of those expressions must be 1. 
  The 
code below computes it numerically  for some more or less random values of 
N and M,  and it is 1.  for those values, but I can't figure out how to 
compute it symbolically.   Also,  if there's a better way to do polynomial 
division than I've used below,  please tell me.

def nov13b():
var('p,q,r,N,M,x')
a = sqrt(3)/2
b = (x-x^(-1))/(2*i)
c = (sqrt(3)/2)* (x+x^(-1))/2 + (1/2)*(x-x^(-1))/(2*i)
X = (M/3)*(a+b+c)
f = 24*(X^2-N*b*c)*x^2
g = (f.maxima_methods().divide(x+1)[0]).full_simplify()
print(g.full_simplify())
print("")
t = exp(-pi*i/3)
print(g(x=t).full_simplify())
print("")
h = (g.maxima_methods().divide(x-t)[0]).full_simplify()
print("h = ")
print(h)
print("")
answers = solve(h,x)
assume(N,'integer')
assume(M,'integer')
for u in answers:
print("")
ans = u.rhs().simplify()
for k in range(230,245):
ans_numerical = abs(ans.substitute(M=11,N=243)).simplify()
print(n(ans_numerical))





-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: documentation?

2018-11-14 Thread Michael Beeson
Oops,  "243" in my post should have been "k".   I don't know how to edit a 
post after I've posted it.


On Wednesday, November 14, 2018 at 10:31:34 PM UTC-8, Michael Beeson wrote:
>
> After quite some searching I did not succeed to find documentation for 
> sage functions to work with complex numbers as much as I would like. 
> For example  if I have a complicated rational expression,  how can I tell 
> Sage "bring this to the form a + bi".  It seems real() and imag()  only 
> work
> if no pre-processing is needed.   How about "multiply numerator and 
> denominator by denominator.conjugate()" ?  There's probably a chapter in 
> the documentation about this,  could someone please point me to it,  I 
> seem to be incompetent at finding it, sorry.  
>
> Since people want something concrete to look at, not just a general 
> question,  here is some code.   You'll see that it computes a certain 
> complex function (actually two of them)
> with integer parameters N and M,  the solution(s) of a certain equation.   
> I'd like to compute that the absolute value of those expressions must be 1. 
>   The 
> code below computes it numerically  for some more or less random values of 
> N and M,  and it is 1.  for those values, but I can't figure out how to 
> compute it symbolically.   Also,  if there's a better way to do polynomial 
> division than I've used below,  please tell me.
>
> def nov13b():
> var('p,q,r,N,M,x')
> a = sqrt(3)/2
> b = (x-x^(-1))/(2*i)
> c = (sqrt(3)/2)* (x+x^(-1))/2 + (1/2)*(x-x^(-1))/(2*i)
> X = (M/3)*(a+b+c)
> f = 24*(X^2-N*b*c)*x^2
> g = (f.maxima_methods().divide(x+1)[0]).full_simplify()
> print(g.full_simplify())
> print("")
> t = exp(-pi*i/3)
> print(g(x=t).full_simplify())
> print("")
> h = (g.maxima_methods().divide(x-t)[0]).full_simplify()
> print("h = ")
> print(h)
> print("")
> answers = solve(h,x)
> assume(N,'integer')
> assume(M,'integer')
> for u in answers:
> print("")
> ans = u.rhs().simplify()
> for k in range(230,245):
> ans_numerical = abs(ans.substitute(M=11,N=243)).simplify()
> print(n(ans_numerical))
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: different result from file or at prompt

2018-11-14 Thread Michael Beeson
Justin, that is right.  "return"  caused a graph to be drawn. 
Now that you pointed out why it didn't work,  I see another solution:

graph = complex_plot(g, (-3, 3), (-3, 3))
graph.show()

which doesn't require a return statement;  since my original intention was 
to put 
the drawing command inside a loop and draw a lot of graphs,  I'll need to 
do it with "show" 
rather than "return".   Thank you.

Michael

On Tuesday, November 13, 2018 at 8:38:52 PM UTC-8, Michael Beeson wrote:
>
> def nov13():
> var('M,N,z')
> f = (M^2-3*N)*(-i *sqrt(3)-1) *z^3 
> f = f + (M^2 *(-i *sqrt(3) +3) + 3*N*(-i *sqrt (3) - 1))*z^2 
> f = f + (M^2 *(i *sqrt(3)+3) + 3*N* (i* sqrt(3)-1))*z + (M^2-3*N)* (i* 
> sqrt(3)-1)
> g = f.substitute(M=6,N=11)
> complex_plot(g, (-3, 3), (-3, 3))
>
> if this code is put in a file and the file is "attached"  I get no plot, 
> but if 
> I paste the function body in to a prompt then I do get a (very nice) plot. 
>  
> I expected it would run from an attached file, which is how I usually use 
> SageMath.
> Can someone explain why I don't get a plot that way?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] different result from file or at prompt

2018-11-13 Thread Michael Beeson
def nov13():
var('M,N,z')
f = (M^2-3*N)*(-i *sqrt(3)-1) *z^3 
f = f + (M^2 *(-i *sqrt(3) +3) + 3*N*(-i *sqrt (3) - 1))*z^2 
f = f + (M^2 *(i *sqrt(3)+3) + 3*N* (i* sqrt(3)-1))*z + (M^2-3*N)* (i* 
sqrt(3)-1)
g = f.substitute(M=6,N=11)
complex_plot(g, (-3, 3), (-3, 3))

if this code is put in a file and the file is "attached"  I get no plot, 
but if 
I paste the function body in to a prompt then I do get a (very nice) plot.  
I expected it would run from an attached file, which is how I usually use 
SageMath.
Can someone explain why I don't get a plot that way?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] full_simplify() gets wrong answer

2018-11-12 Thread Michael Beeson
def demo():
var('N,x')
test = ((N*(3*I*sqrt(3) + 9) + N*(3*I*sqrt(3) - 3)))*x
print("test = ")
print(test)
print("test.full_simplify() = ")
print(test.full_simplify())

Here is the output

sage: demo()

test = 

(N*(3*I*sqrt(3) + 9) + N*(3*I*sqrt(3) - 3))*x

test.full_simplify() = 

(36*I*sqrt(3)*N + 6)*x


The answer should have 6  where it has 36.  If you take the "*x" off the 
end of test,

then Sage answers correctly.


sage: version()

'SageMath version 8.0, Release Date: 2017-07-21'



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] unable to install sagemath, segmentation faults

2018-02-27 Thread Michael Murphy


any idea why this segmentation fault happens when I try to install? 

"patching 
/Users/michaelmurphy/Desktop/SageMath/local/lib/python2.7/site-packages/matplotlib-1.5.1-py2.7-macosx-10.9-x86_64.egg/matplotlib/_png.so
/Users/michaelmurphy/Desktop/SageMath/src/bin/sage-env: line 408: 330 
Segmentation fault "$SAGE_ROOT/local/bin/python" -c 'import pkg_resources; 
pkg_resources.get_distribution("matplotlib").version' 2> /dev/null"


I am running MacOS 10.6.8

the binary that I used were :






*sage-7.3-OSX_10.11.6-x86_64.dmg* 
 and 




*sage-7.3-OSX_10.11.6-x86_64.tar.bz2* 


and *sage-7.1-OSX_10.11.3-x86_64.dmg* 

this last one is the one whose output is pasted above

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] computing problem

2018-02-26 Thread Michael Colin D' Souza
integral(sqrt(cos(2*(x)))/sin(x),x) gave a runtime error message 
"RuntimeError: ECL says: Error executing code in Maxima:".

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] What do the different `make ****clean` targets do?

2018-02-13 Thread Michael Orlitzky
On 02/11/2018 08:57 PM, rickhg12hs wrote:
> I've built from source to get a performance boost (I hope) and I'd like
> to know when I should use the different levels of `make clean`.  In
> the top-level make file I see, "misc-clean, bdist-clean, clean,
> distclean, build-clean, bootstrap-clean, maintainer-clean,
> sagelib-clean" as either targets or dependencies of targets.

I can only partially answer your question; some of those are standard
targets that come from autotools:

  https://www.gnu.org/prep/standards/html_node/Standard-Targets.html

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Simplifying symbolic expression with radicals

2017-10-16 Thread Michael Orlitzky
On 10/16/2017 04:21 PM, Emily G wrote:
> 
> (*2* + sqrt(*2*))/(*1* + sqrt(*2*))
> 
> The above example should simplify to sqrt(2),
> but simplify_full() and canonicalize_radical() don't work. Is there a
> way that I can get Sage to simplify such expressions?
> 

This gets the result that you want,

  sage: f = (2 + sqrt(2))/(1 + sqrt(2))
  sage: f._sympy_().simplify()
  sqrt(2)

by using SymPy's simplification routine instead of the default Maxima
one. I'm not sure how safe that is in general (e.g. it might do weird
things with complex numbers), so I'd read through the SymPy docs before
using it on anything important.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Issue with ticket number #29146

2017-03-04 Thread Michael Orlitzky
On 03/03/2017 08:32 AM, Ashutosh Ahelleya wrote:
> 
> No. I guess the back end does return a complex parameter in cases where the 
> answer is a complex solution.  
> This might be an appropriate example:
> { { sage: 
> x = var('x')
> eq = x^2 -3*x + 4
> solve(eq,x)
> [x == -1/2*I*sqrt(7) + 3/2, x == 1/2*I*sqrt(7) + 3/2]
> } } 
> Here, in this example, the parameter used is 'I'.

I was actually curious if Sage ever returns an arbitrary "r1" constant
to refer to a complex number. There is the special case where we turn
"all" into "r1", but there may not be any others.

If it's possible for "r1" to represent a complex number in any other
situation, then the correct course of action is clear: update the
documentation to say that "r1" is complex.

On the other hand, if "r1" is always real except in one specific case
(the "all" result), then maybe it makes more sense to leave the
documentation as-is, and return something else (c1?) for the "all" result.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Issue with ticket number #29146

2017-03-03 Thread Michael Orlitzky
On 03/02/2017 10:57 PM, Ashutosh Ahelleya wrote:
> Hello,
> 
> I am interested in solving the documentation error having ticket number 
> #29146 but I have a doubt.
> 
> In the description of ticket number #29146 
>  , I feel within the domain of x 
> that is a real number the documentation is correct since the solution is 
> shown up to be 
> "r1" which is a real number. In case the domain is over complex numbers 
> too, what should be the appropriate symbol in place of "r1" to be used to 
> fix this?
> 

The symbol "z" is used for integers already, so that's out. I wonder if
any of our equation-solving backends ever return complex parameters...
on the other hand, the Maxima documentation doesn't say they're real:

 The symbols %r are used to denote arbitrary constants in a solution[1].

So maybe it was an overstatement to say that the "r" parameters are
real, as far as Maxima is concerned. In any case, there is a special
branch in the code that handles the result of x == x,

  if s == 'all':
  if solution_dict:
  ans = [ {x: self.parent().var('r1')} ]
  else:
  ans = [x == self.parent().var('r1')]
  if multiplicities:
  return ans,[]
  else:
  return ans

So you could update the documentation to say that the "r" parameters are
complex, or I guess you could try to add a new type of complex
parameter. If none of our backends ever return them, though, the latter
seems like overkill.


[1] http://maxima.sourceforge.net/docs/manual/maxima_20.html

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] simplifying radicals of trigonometric expressions

2017-01-15 Thread Michael Orlitzky
On 01/14/2017 03:42 AM, Enrique Artal wrote:
> This is true. The problem is that if not used, simple expressions keep to 
> be too much complicated. Is there any compromise?
> 

There is simplify_full() which should be safe for all expressions, and
simplify_real() that assumes everything is real. Those two methods use
our Maxima backend.

The sympy backend has improved a lot, too. There's no easy way to get
access to it, but something like this should work:

  sage: import sympy
  sage: f = sin(x/(x^2 + x))
  sage: sympy.simplify(sympy.sympify(f))
  sin(1/(x + 1))

In the case of f = sqrt(cos(x)^3 - 3*cos(x)^2 - cos(x) + 6), did you
have any particular simplification in mind? I don't see anything obvious
that can be done.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Displaying graphics from a Sage script

2017-01-13 Thread Michael Orlitzky
On 01/13/2017 06:50 PM, John H Palmieri wrote:
> This question comes from 
> http://stackoverflow.com/questions/41638257/graphics-in-sage-script: if I 
> have a file "foo.sage" and I want to run "sage foo.sage" and have it pop up 
> a window displaying a plot, how do I do this?
> 
> For example, if foo.sage contains
> 
> P = plot(sin(x))
> P.show()
> 
> then it prints "Graphics object consisting of 1 graphics primitive" rather 
> than displaying the plot. I know I can save the plot instead, but is there 
> an easy way to display it directly?
> 

import os.path
import subprocess
import tempfile
from sage.all import *

x = SR.var('x', domain='real')
p = plot(sin, x, -pi, pi)
imgpath = os.path.join(tempfile.mkdtemp(), 'foo.png')
p.save(imgpath)
subprocess.call(["xdg-open", imgpath])

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] simplifying radicals of trigonometric expressions

2017-01-13 Thread Michael Orlitzky
On 01/13/2017 05:12 AM, Enrique Artal wrote:
> I would like to know how to handle with this issue. Consider a function
> f=sqrt(cos(x)^3 - 3*cos(x)^2 - cos(x) + 6). It is possible to deal with
> this function for standard procedures like numerical_integral in (-1,1).
> If one considers f.canonicalize_radical() it is presented
> as sqrt(cos(x)^2 - cos(x) - 3)*sqrt(cos(x) - 2), which avoids numerical
> integration in particular since each factor is complex in (-1,1). It is
> not solved if x is declared as a real variable (with domain='real'). For
> this particular function, it is not hard to avoid the issue, but if it
> appears in more complex expressions, it is less obvious.

Don't use canonicalize_radical =)

If you read its documentation, there is a big WARNING stating that it is
going to do weird and unpredictable things. As you have discovered, it's
not a form of simplification -- the input and output may be wildly
different functions.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Sage cannot find gcc on OS X

2017-01-10 Thread Michael Frey
Thank you for the quick reply.

I have xCode installed.  gcc is located at /Applications
/Xcode.app/Contents/Developer/usr/bin/.

There about 50 versions of limits.h.  Which one is sage looking for?

Mike



On Tuesday, January 10, 2017 at 12:12:18 AM UTC-5, Michael Frey wrote:
>
> I am running the Sage app on OS X.  My code makes a call to cython.  When 
> I execute the code I get an error:
>
> gcc -fno-strict-aliasing 
> -I/Users/buildslave-sage/slave/binary_pkg/build/source/SageMath/jc4b6yulaujayb9sr94ia88eourzeqip0oidma/local/var/tmp/sage/build/python2-2.7.10.p3/include
>  -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused 
> -I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/include 
> -I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/include/python2.7
>  
> -I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/python2.7/site-packages/numpy/core/include
>  
> -I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/python2.7/site-packages
>  
> -I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/ext
>  
> -I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/python2.7/site-packages/cysignals
>  -I/Users/michael/.sage/temp/Michaels-MBP.freystuff.com/34036 
> -I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/include/python2.7
>  -c 
> _Users_michael__sage_temp_Michaels_MBP_freystuff_com_34036_tmp_81FKRa_spyx_0.c
>  -o 
> build/temp.macosx-10.9-x86_64-2.7/_Users_michael__sage_temp_Michaels_MBP_freystuff_com_34036_tmp_81FKRa_spyx_0.o
>  -w -O2
>
> In file included from 
> /Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/include-fixed/syslimits.h:7:0,
>  from 
> /Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/include-fixed/limits.h:34,
>  from 
> /Applications/SageMath-7.4.app/Contents/Resources/sage/local/include/python2.7/Python.h:19,
>  from 
> _Users_michael__sage_temp_Michaels_MBP_freystuff_com_34036_tmp_81FKRa_spyx_0.c:4:
> /Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/include-fixed/limits.h:168:61:
>  fatal error: limits.h: No such file or directory
>  #include_next   /* recurse down to the real one */
>  ^
> compilation terminated.
> error: command 'gcc' failed with exit status 1
>
>
> The limits.h file exists:
>
> pwd
>
> /Applications/SageMath-7.4.app
>
> Michaels-MBP:SageMath-7.4.app michael$ find . -type f -iname 'limits.h' -ls
>
> 13735298 -rw-r--r--1 michael  admin
> 1214 Oct 19 16:11 
> ./Contents/Resources/sage/local/include/c++/4.9.3/tr1/limits.h
>
> 1376268   16 -rw-r--r--1 michael  admin    
> 5382 Oct 19 16:07 
> ./Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/include-fixed/limits.h
>
> 1376277   16 -rw-r--r--1 michael  admin
> 5382 Oct 19 16:11 
> ./Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/install-tools/include/limits.h
>
>
> Hopefully there is an easy fix for this.
>
> Mike
>
> Code:
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Sage on Mac OS X Latex Error

2017-01-09 Thread Michael Frey
I am trying to generate a plot in sage with matplotlib.  When I execute a 
safefig I get an error:

RuntimeError: LaTeX was not able to process the following string:
'lp'
Here is the full report generated by LaTeX:


Hopefully there is an easy fix for this.  The code works on Centos.

Mike

Code:
def shape_plot(rf_shape_pl, amp_shape_pl, phase_shape_pl, Pname_sh):
"""
Plot Pulse Shape
"""
x_line= srange(0, 1, 1/len(rf_shape_pl))
sh_r=ceil(max(rf_shape_pl))
if sh_r < abs(floor(min(rf_shape_pl))): sh_r = 
abs(floor(min(rf_shape_pl)))
fig = Figure(figsize=(8,3))
fig.subplots_adjust(bottom=0.18, top=0.88, left=0.06, right= 0.97, 
wspace=0.3, hspace=0.35)
canvas = FigureCanvas(fig)

ax = fig.add_subplot(131)
ax.axvline(x=0, color='0' )
ax.axhline(y=0, color='0' )
ax.set_xlabel('shape', fontsize=('small'))
ax.plot(x_line, rf_shape_pl, color='r')
ax.set_ylim(-sh_r,sh_r)

bx = fig.add_subplot(132)
bx.axvline(x=0, color='0' )
bx.axhline(y=0, color='0' )
bx.set_xlabel('amplitude only', fontsize=('small'))
bx.plot(x_line, amp_shape_pl, color='b')
bx.set_title(Pname_sh)

cx = fig.add_subplot(133)
cx.axvline(x=0, color='0' )
cx.axhline(y=0, color='0' )
cx.set_xlabel('phase only', fontsize=('small'))
cx.plot(x_line, phase_shape_pl*180/np.pi, color='g')
cx.set_ylim(-10,190)
fig.savefig(DATA+'shape_plot.png')

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Sage cannot find gcc on OS X

2017-01-09 Thread Michael Frey
I am running the Sage app on OS X.  My code makes a call to cython.  When I 
execute the code I get an error:

gcc -fno-strict-aliasing 
-I/Users/buildslave-sage/slave/binary_pkg/build/source/SageMath/jc4b6yulaujayb9sr94ia88eourzeqip0oidma/local/var/tmp/sage/build/python2-2.7.10.p3/include
 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused 
-I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/include 
-I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/include/python2.7
 
-I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/python2.7/site-packages/numpy/core/include
 
-I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/python2.7/site-packages
 
-I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/ext
 
-I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/python2.7/site-packages/cysignals
 -I/Users/michael/.sage/temp/Michaels-MBP.freystuff.com/34036 
-I/Applications/SageMath-7.4.app/Contents/Resources/sage/local/include/python2.7
 -c 
_Users_michael__sage_temp_Michaels_MBP_freystuff_com_34036_tmp_81FKRa_spyx_0.c 
-o 
build/temp.macosx-10.9-x86_64-2.7/_Users_michael__sage_temp_Michaels_MBP_freystuff_com_34036_tmp_81FKRa_spyx_0.o
 -w -O2

In file included from 
/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/include-fixed/syslimits.h:7:0,
 from 
/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/include-fixed/limits.h:34,
 from 
/Applications/SageMath-7.4.app/Contents/Resources/sage/local/include/python2.7/Python.h:19,
 from 
_Users_michael__sage_temp_Michaels_MBP_freystuff_com_34036_tmp_81FKRa_spyx_0.c:4:
/Applications/SageMath-7.4.app/Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/include-fixed/limits.h:168:61:
 fatal error: limits.h: No such file or directory
 #include_next   /* recurse down to the real one */
 ^
compilation terminated.
error: command 'gcc' failed with exit status 1


The limits.h file exists:

pwd

/Applications/SageMath-7.4.app

Michaels-MBP:SageMath-7.4.app michael$ find . -type f -iname 'limits.h' -ls

13735298 -rw-r--r--1 michael  admin1214 
Oct 19 16:11 ./Contents/Resources/sage/local/include/c++/4.9.3/tr1/limits.h

1376268   16 -rw-r--r--1 michael  admin5382 
Oct 19 16:07 
./Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/include-fixed/limits.h

1376277   16 -rw-r--r--1 michael  admin5382 
Oct 19 16:11 
./Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.6.0/4.9.3/install-tools/include/limits.h


Hopefully there is an easy fix for this.

Mike

Code:

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Error when attaching file, NameError: name 'cython' is not defined

2017-01-09 Thread Michael Frey
I am trying to attach a code file to a sage notebook.  The call is : attach 
("~/.sage/MHF_Bloch_n_Plot.sage").  The error I get is "NameError: name 
'cython' is not defined".  The code in the attach file is:

...

cython("""

#Parallel Cython, Numpy calls -- 3 part3

#Part 1

#Cython version for parallel

import numpy as np

import scipy as sp

from scipy import linalg

cimport numpy as np

cdef extern from "math.h":

float cosf(float theta)

float sinf(float theta)

...

""")

...


Am I missing something or is this a bug?

I am using sage 7.4 in a Fusion Centos 7.2 VM on a MacBook Pro.


I have other problems with the native OS X Sage app and will submit those 
later.


Thank you for your help. 

Mike

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Plotting long functions

2016-12-29 Thread Michael Orlitzky
On 12/29/2016 04:46 AM, Fjordforsk A/S wrote:
> Thanks Michael. I am plotting it now, and it is just waiting without giving 
> a crash. 
> Is it automatically right to use complex_plot command to plot the imaginary 
> part of the same plot as given below?
> 

It depends, do you expect your function to take on complex values? When
plotting, sage is forced to evaluate your expression numerically at a
number of points. That isn't 100% accurate, and you can wind up with a
situation where expression1 == expression2, but numerically evaluating
(expression1 - expression2) gives you e.g. 0.000134*i.

In cases like that, you want to throw away the imaginary part, because
your function isn't actually imaginary. If you were to use complex_plot
on something like that, the result would only mislead you.


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] simplify

2016-12-29 Thread Michael Orlitzky
On 12/29/2016 04:48 AM, Ingo Dahn wrote:
> 
> According to tab completion SageCell doesn't seem to support any other form 
> of *simplify*. Is there any strategy to combine Sage commands in order to 
> simplify rational function expressions?

Plain "simplify" won't do much on its own. I guess it's only a top-level
function (as opposed to a method) because users of Mathematica and
friends will expect it to be there. But the good stuff can be found as
methods on the expression object:

  sage: q=(x^2+4*x+4)/(x+2)^2
  sage: q.simplify_full()
  1

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Plotting long functions

2016-12-28 Thread Michael Orlitzky
On 12/28/2016 10:33 AM, Fjordforsk A/S wrote:
> This is how its supposed to go:
> 
> sage: plot3d(((1 - (3/8 - 3*t^2 - 2*t^4 - 9*x^2 - 10*x^4 - 12*t^2*x^2) + 
> i*x*(15/4 + 6*t^2 - 4*t^2 - 2*x^2 - 4*x^4 + 8*t^2*x^2))/(1/8*(3/4 + 9*t^2 + 
> 4*t^2+ 16/3*t^6 + 33*x^2 + 36*x^24 + 16/3*x^6)))*e^(i*x)), (x, -2, 2), (t, 
> -2, 2)
> 
> 
> However, Sage thinks that 3*t^2 = Integer(3)*tInteger(2) 
> 
> That is , twice multiplied with 2, and not exponent to two.

The double-star means exponentiation in both python and in sage:

  sage: 2^8
  256
  sage: 2**8
  256

But beware, the carat "^" has a special meaning in sage. In python, it
does something else entirely:

  >>> 2^8
  10

In any case, your problem is elsewhere... I think you've got an extra
parenthesis at the end of your expression. Instead of "e^(i*x))", you
should have "e^(i*x)". Then you'll need another parenthesis at the end
of the whole thing.

After that, well, at least you get a different error =)

It crashes for me because it's trying to plot a point with a non-zero
imaginary part. It could be that the imaginary part is tiny -- in which
case you can throw it away -- or else you might have to rearrange your
expression, or break up the domain.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Plotting long functions

2016-12-28 Thread Michael Orlitzky
On 12/28/2016 07:12 AM, Fjordforsk A/S wrote:
> Hello, I am not sure on the reply sage gives me on plotting a long function:
> 
> sage: plot3d(((1 - (3/8 - 3*t^2 - 2*t^4 - 9*x^2 - 10*x^4 - 12*t^2*x^2) + 
> x*(15/4 + 6*t^2 - 4*t^2 - 2*x^2 - 4*x^4 + 8*t^2*x^2))/(1/8*(3/4 + 9*t^2 + 
> 4*t^2+ 16/3*t^6 + 33*x^2 + 36*x^24 + 16/3*x^6)))*e^(x)), (x, -2, 2), (t, 
> -2, 2) 
> 
> 
> TypeError: plot3d() takes at least 3 arguments (1 given)
> 
> I have defined x and t as variables, should I define e as well?
> 

I think you just made a typo in there somewhere. The function part of
your example doesn't parse as a function; I get a syntax error if I do f
= .

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] how to force the use of Atlas instead of Openblas during the build of 7.4?

2016-11-04 Thread Michael Orlitzky
On 11/04/2016 05:17 AM, Dima Pasechnik wrote:
> Documentation on this is lacking.
> 

It's a ./configure option, --with-blas=atlas. And at least in the near
future, a good place for it would be in the error message you get after
OpenBLAS fails to compile...

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] linear solutions

2016-09-10 Thread Michael Orlitzky
On 09/10/2016 04:41 PM, Anton Sherwood wrote:
> I haven't guessed the right keywords.  How do I solve a set of linear 
> equations in which the coefficients are symbolic expressions like 
> a^2-sqrt(b)?
> 

Try creating vectors/matrices over the symbolic ring "SR", and then use
solve_left or solve_right. For example,

  sage: a,b = SR.var('a,b',domain='real')
  sage: A = matrix(SR,[[a+b, a-b],[a-b^2,a+b^2]])
  sage: z = vector(SR,[1,2])
  sage: A.solve_right(z)
  (-(a - b)*((b^2 - a)/(a + b) + 2)/((b^2 + (b^2 - a)*(a - b)/(a + b) +
  a)*(a + b)) + 1/(a + b), ((b^2 - a)/(a + b) + 2)/(b^2 + (b^2 - a)*(a
  - b)/(a + b) + a))


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Substituting values for variables

2016-06-16 Thread Michael Orlitzky
On 06/13/2016 11:02 AM, saad khalid wrote:
> Hey everyone:
> 
> So, I start by making a symbolic function. Gamma(k) is the sum of some
> variables, u_i. Generating the function by hand is difficult, so I was
> hoping I could make it so that Sage generates the function and then I
> can give values for the u_i's, and have it compute the value for me.
> However, even after I give values to the u's, it doesn't substitute them
> into the equation.

You're not telling it to substitute... Here, you define "u" to be a list:

> u =[SR("u_%i"%x)forx in[0..6]]

And here, you set the *elements* of that list to -1:

> u[1]=-1
> u[2]=-1
> u[3]=-1
> u[4]=-1

That has no effect on the variables (u_i) that you defined earlier. It
just overwrites them with the object "-1".

Substitution with arrays of variables is a little bit weird. Try this:

  sage: reset()
  sage: G = 5
  sage: u = [SR("u_%i"%x) for x in [0..6]]
  sage: gamma(k) = (1/G)*sum(-(u[i])^(k-1)/(u[i]-1)^k for i in (1..G-1))
  sage: f = 1/5 - 3*2/5 + 3*gamma(2) - gamma(3)
  sage: f.subs({u[1]: -1, u[2]: -1, u[3]: -1, u[4]: -1})
  -1/2


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Michael Orlitzky
On 05/24/2016 10:20 AM, Vincent Delecroix wrote:
> 
> The above is coherent. But I would prefer if simplify_real would raise 
> an error if some argument of sqrt has a chance to be < 0.
> 

What about sqrt(2*x^16 + 10*x^11 - 9*x^10 + x^7 + x^4 - 17*x^2 - x)?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Michael Orlitzky
On 05/24/2016 09:55 AM, Vincent Delecroix wrote:
> Well
> 
> sage: (sqrt(-x) * sqrt(x) * sqrt(-x) * sqrt(x)).simplify_real()
> -x^2
> 

If you're sure that every expression involved is real, that's still the
correct answer, because x == 0. If sqrt(x) or sqrt(-x) might not be
real, you're going to get nonsense calling simplify_real() on them.



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] sqrt(pi)*sqrt(n) != sqrt(pi*n)

2016-05-10 Thread Michael Orlitzky
On 05/10/2016 04:56 PM, Vincent Delecroix wrote:
> still
> 
> sage: n = SR.var('n')
> sage: assume(n, 'real')
> sage: assume(n >= 0)
> sage: bool(sqrt(pi)*sqrt(n) == sqrt(pi*n))
> False
> 

What `bool(expr1 == expr2)` does is something like,

  bool((expr1 - expr2).simplify_full() == 0)

As long as you're sure that everything involved is real, adding
simplify_real() into the mix will perform two extra simplifications that
simplify_full() will not, so you get better results in that case.

To make it Do The Right Thing by default, you would have to modify
simplify_full() to loop through all of the terms in the expression and
check if they're real. If they are, you could call simplify_real() in
addition to the other simplifications that simplify_full() does.

(There may be problems with that approach, but that's the idea, anyway.)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] sqrt(pi)*sqrt(n) != sqrt(pi*n)

2016-05-10 Thread Michael Orlitzky
On 05/06/2016 09:50 PM, Marc Tardif wrote:
> Hi folks,
> 
> When comparing the product of two square roots to the square root of
> the product using two scalars, I get True:
> 
> sage: bool(sqrt(pi)*sqrt(2) == sqrt(pi*2))
> True
> 
> But when using a variable instead of one of the scalars, I get False:
> 
> sage: n = var('n')
> sage: assume(n>=0)
> sage: bool(sqrt(pi)*sqrt(n) == sqrt(pi*n))
> False
> 

The identity isn't true in general. Take,

  i * i = sqrt(-1) * sqrt(-1) = -1

and apply the identity:

  sqrt(-1 * -1) = sqrt(1) = 1.

In Sage, variables are complex by default, so we can't use that
identity. In a perfect world, your assumption that n >= 0 would fix
that, but the "safe" simplification routines involved with
bool() aren't smart enough to use it.

Instead, you can try,

  sage: (sqrt(pi)*sqrt(n) - sqrt(pi*n)).simplify_real()
  0

The simplify_real() method can be a little more extreme since you're
making it clear that you want to treat the expression as real.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: is_prime() error

2016-04-05 Thread Michael Orlitzky
On 04/05/2016 01:03 PM, William Stein wrote:
> 
> I think we should change is_prime for rational numbers, since people
> get confused by this so much.
> 
> How?  Pretty much any change at all would be better than the current
> situation.  Options I can think of:
> 
> - make is_prime([rational]) raise an error and tell the user what to do
> - look at what is_prime([rational]) does in Pari, Mathematica, etc.,
> and do the same thing
> - make is_prime([rational]) return is_prime(ZZ([rational]))-- this
> would be a change that would potentially silently break some code, but
> is what many people expect.
> 

Why not have two? The problem is that everyone knows what is_prime() is
supposed to do -- it's supposed to tell you if a number is prime. Except
it doesn't always do that, it does some abstract mumbo jumbo whenever
you don't have an integer (even if you do "have an integer").

We could leave is_prime() for humans, and have is_prime_in_ring() for
people who know what that means.


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Moore–Penrose pseudoinverse?

2016-03-24 Thread Michael Orlitzky
On 03/24/2016 10:44 AM, Jeroen Demeyer wrote:
> Does anybody know of an implementation of the Moore–Penrose 
> pseudoinverse (a generalised inverse for matrices) in Sage? I couldn't 
> find anything, but just in case I RTFM badly or it's known under some 
> different name, I ask here.
> 

I looked once but didn't find anything. We're missing the SVD for rings
like RR, or it would be easy to fix.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Linear algebra and least squares regression

2016-03-02 Thread Michael Orlitzky
On 02/29/2016 10:19 PM, Emerson Misch wrote:
> I am new to sage and have little knowledge of its computing power and am 
> interested in the coding for a few things. 
> 
> 1) Creating a vector space V over the field of Svalbard (all reals) or C of a 
> given dimension n.

sage: VectorSpace(RR,n)

or

sage: VectorSpace(CC,n)


> 2) Finding the dimension and basis of V

sage: V = VectorSpace(QQ,3)
sage: V.dimension()
3
sage: V.basis()
[
(1, 0, 0),
(0, 1, 0),
(0, 0, 1)
]


> 3) creating subspaces U and W of V

sage: U = V.subspace([ V([1,1,1]), V([1,1,-1]) ])
sage: W = V.subspace([ V([3,0,1]), V([7,2,0]) ])


> 4) creating the intersection of U and W and the direct sum of U and W.

Depends on what you mean by "direct sum." There's,

sage: U.direct_sum(W)

and

sage: U + W

The latter will only be a direct sum if you make it one (by having U =
W.complement()). Intersection is easy:

  sage: U.intersection(W)


> 5) using the method of least squares to find a linear function that best 
> matches the data:
> 
> X : (x1,x2,...,xn)
> Y: ( y1,y2,...,yn)

This depends on the size of the problem. If it's small enough, you can
solve it algebraically (there's a matrix formula).

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] console prompt color

2016-01-27 Thread Michael Orlitzky
On 01/26/2016 10:17 PM, Volker Braun wrote:
> On Tuesday, January 26, 2016 at 5:09:52 PM UTC-5, Michael Orlitzky wrote:
> 
> You're just using "reasonable" to mean "has the color scheme I like."
> 
> 
> That black text on white background is the most legible color scheme is
> an empirical fact.

It's not an empirical fact but I'm almost certain you know that. The
thing you actually observe from experiment is that more people find
light-on-dark a little bit more legible than dark-on-light. It is an
empirical fact that some people prefer dark-on-light. And the whole
thing is irrelevant when the user can choose which one he prefers.

The suggestion that we should only support more-legible-on-average
terminals is also bizarre. You wouldn't manufacture gloves that only
work with an average number of fingers, especially if you had an
alternative that worked for everybody (like we do). That definition of
"reasonable" doesn't hold up to reality. The UNIX terminal -- the thing
that terminal emulators emulate -- is light-on-dark, and many terminal
emulators look just like it until you configure them otherwise.
Distributions are shipping terminals with light-on-dark themes. People
constantly ask how to change the sage color scheme. You can only throw
out so much "bad" evidence before you have to question the definition.

Every time one of these people with unreasonable taste tries sage and
can't read what it says -- if he finds the mailing lists page, and
figures out that sage-support is the right one, and manages to sign up,
and verifies his email address, and then posts to the list, and then
waits a day or two for me to check my email and respond -- I'll let him
know how to make sage display text in his terminal, and he can finally
get started.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Writing 'n' variables in Sagemath linux ubuntu

2016-01-27 Thread Michael Orlitzky
On 01/27/2016 12:47 AM, Jori Mäntysalo wrote:
> If I understood this, isn't
> 
> var(['a'+str(i) for i in range(1,4)])
> 
> what is wanted? It will make a1, a2 and a3 to variables.
> 

Yeah, but then you can't reference them later.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] compile sage from source to link to existing applications

2016-01-26 Thread Michael Orlitzky
On 01/26/2016 01:13 AM, bernard ck Wong wrote:
> Hi, I am wondering if it is possible to compile Sage from source and
> configure it in such a way that it will use software that is already
> installed in my system instead of building the bundled ones? For
> example, I have R, Singular and Maxima already installed in their latest
> versions and I have already built atlas optimised to my machine. It
> seems that there is no point for sage to create duplicates which are
> either older or not as well tuned to my setup.

The only way to do this right now is with sage-on-gentoo [0], which
works easily only if you happen to use Gentoo Linux. Otherwise you would
have to get a Gentoo Prefix [1] up and running, and then add
sage-on-gentoo to that.

Installing Prefix can be pretty hairy -- most Prefix users switch to
Gentoo eventually so demand is always low. But still, it's faster to
build an entire prefix system from scratch and then build sage-on-gentoo
twice than it is to build sage twice using the official process.

[0] https://github.com/cschwan/sage-on-gentoo
[1] https://wiki.gentoo.org/wiki/Project:Prefix

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] console prompt color

2016-01-26 Thread Michael Orlitzky
On 01/24/2016 03:03 PM, Jagdpanther wrote:
> I just compiled  SageMath 7.0.  Both the console and notebook interface
> seem to work well.  I use a dark gray background in my xterm (uxterm)
> window where I run sage (console)  and the dark blue "sage:" prompt is
> hard to see.  How do I change the color of the console "sage:" prompt?

Rather annoying isn't it =)

The default should be NoColor, since whatever color scheme we choose is
going to be awful for a large number of users. To change it once, run

  sage: %colors NoColor

To change it permanently, add that command to your init.sage file:

  $ echo '%colors NoColor' >> ~/.sage/init.sage

If it works for you, you may prefer the color scheme designed for
light-on-dark terminals, obtained with "%colors Linux".

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: [sage-edu] Writing 'n' variables in Sagemath linux ubuntu

2016-01-26 Thread Michael Orlitzky
> On Tue, Jan 26, 2016 at 3:01 AM, Usman Afzal  wrote:
>> If I want to write one variable, the command is
>> x=var('x')
>>
>> But I want to write "n" variables namely x1, x2, . . . , x(n). How can I
>> write this?

This is http://trac.sagemath.org/ticket/11576, but it's dead in the
water. I still maintain and use my SymbolSequence implementation. I'm
attaching symbol_sequence.py; to use it, load it in your sage session:

  sage: load('symbol_sequence.py')

Then to declare a list of variables "x1", "x2", and so on, write,

  sage: x = SymbolSequence('x')

Now you can use array indexes to get as many variables as you need:

  sage: x[0]
  x_0
  sage: x[1]
  x_1
  sage: x[10]
  x_10

Multiple subscripts and slices work the way you'd want them to:

  sage: [ a[i,j] for i in range(0,2) for j in range(0,2) ]
  [a_0_0, a_0_1, a_1_0, a_1_1]

And you can use that (for example) to construct matrices:

  sage: d = 5
  sage: X = matrix(SR, d, d, x[0:d,0:d])
  sage: X
  [x_0_0 x_0_1 x_0_2 x_0_3 x_0_4]
  [x_1_0 x_1_1 x_1_2 x_1_3 x_1_4]
  [x_2_0 x_2_1 x_2_2 x_2_3 x_2_4]
  [x_3_0 x_3_1 x_3_2 x_3_3 x_3_4]
  [x_4_0 x_4_1 x_4_2 x_4_3 x_4_4]


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
from sage.all import *

class SymbolSequence:
"""
An iterable object which acts like a sequence of symbolic
expressions (variables).

INPUT:

  - ``name`` -- The sequence name. For example, if you name the
sequence `x`, the variables will be called `x_0`, `x_1`,...

  - ``latex_name`` -- An optional latex expression (string) to
use instead of `name` when converting the symbols to latex.

  - ``domain`` -- A string representing the domain of the symbol,
either 'real', 'complex', or 'positive'.

OUTPUT:

An iterable object containing symbolic expressions.

EXAMPLES:

The simplest use case::

sage: a = SymbolSequence('a')
sage: a[0]
a_0
sage: a[1]
a_1

Create polynomials with symbolic coefficients of arbitrary
degree::

sage: a = SymbolSequence('a')
sage: p = sum([ a[i]*x^i for i in range(0,5)])
sage: p
a_4*x^4 + a_3*x^3 + a_2*x^2 + a_1*x + a_0

Using a different latex name since 'lambda' is reserved::

sage: l = SymbolSequence('l', '\lambda')
sage: l[0]
l_0
sage: latex(l[0])
\lambda_{0}

Using multiple indices::

sage: a = SymbolSequence('a')
sage: a[0,1,2]
a_0_1_2
sage: latex(a[0,1,2])
a_{0}_{1}_{2}
sage: [ a[i,j] for i in range(0,2) for j in range(0,2) ]
[a_0_0, a_0_1, a_1_0, a_1_1]

You can pass slices instead of integers to obtain a list of
symbols::

sage: a = SymbolSequence('a')
sage: a[5:7]
[a_5, a_6]

This even works for the second, third, etc. indices::

sage: a = SymbolSequence('a')
sage: a[0:2, 0:2]
[a_0_0, a_0_1, a_1_0, a_1_1]

TESTS:

We shouldn't overwrite variables in the global namespace::

sage: a = SymbolSequence('a')
sage: a_0 = 4
sage: a[0]
a_0
sage: a_0
4

The symbol at a given index should always be the same, even when
the symbols themselves are unnamed. We store the string
representation and compare because the output is unpredictable::

sage: a = SymbolSequence()
sage: a0str = str(a[0])
sage: str(a[0]) == a0str
True

Slices and single indices work when combined::

sage: a = SymbolSequence('a')
sage: a[3, 0:2]
[a_3_0, a_3_1]
sage: a[0:2, 3]
[a_0_3, a_1_3]

"""

def __init__(self, name=None, latex_name=None, domain=None):
# We store a dict of already-created symbols so that we don't
# recreate a symbol which already exists. This is especially
# helpful when using unnamed variables, if you want e.g. a[0]
# to return the same variable each time.
self._symbols = {}

self._name = name
self._latex_name = latex_name
self._domain = domain


def _create_symbol_(self, subscript):
"""
Return a symbol with the given subscript. Creates the
appropriate name and latex_name before delegating to
SR.symbol().

EXAMPLES::

sage: a = SymbolSequence('a', 'alpha', 'real')
sage: a_1 = a._create_symbol_(1)
sage: a_1
a_1
sage: latex(a_1)
alpha_{1}

"""
# Allow creating unnamed symbols, for consistency with
   

Re: [sage-support] console prompt color

2016-01-26 Thread Michael Orlitzky
On 01/26/2016 03:30 PM, Volker Braun wrote:
> On Tuesday, January 26, 2016 at 12:16:01 PM UTC-5, Michael Orlitzky wrote:
> 
> The default should be NoColor, since whatever color scheme we choose is
> going to be awful for a large number of users.
> 
> 
> I disagree, the default should be good on white background. Every
> reasonable terminal uses that by default as UX research time again
> proved that this is the most readable color scheme. 
> 

You're just using "reasonable" to mean "has the color scheme I like."
We're not talking about a major improvement for the people who use a
light background. It's eye candy, at the cost of catastrophic failure on
terminals with dark backgrounds. Most people who start sage and see
dark-blue-on-black aren't going to go find a mailing list, sign up, and
ask for the secret commands to make it work the way it should already.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Server and certificate chain

2015-11-12 Thread Michael Orlitzky
On 11/12/2015 12:00 AM, kcrisman wrote:
> 
> Can Sagenb send certificate chain instead of just certificate of the
> server itself? If yes, how?
> 
> If not, what do you use as a frontend? Apache?
> 
> 
> Cc:ing someone who may know this; I don't know anything about the
> certificates.
>  

You can probably just concatenate the certificate files. Something like,

  $ cat www.example.com.crt intermediate.pem > combined.crt

Then use combined.crt as the certificate for your site. The order in
which you concatenate them is important. This is also how you're
supposed to do it in newer versions of Apache, but it's still fragile at
this point.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Where is possible to view the code of one command? for example: lagrange_polynomial?

2015-10-05 Thread Michael Orlitzky
On 10/05/2015 10:05 AM, Dmitrij Moreinis wrote:
> Hi everyone, where it is possible to find the code of each command or
> maybe documentation? For example lagrange_polynomial. How can one see
> the function code, but documention would be better. Thank you in advance.
> 

Type the function name followed by a question mark to get the
documentation. Use two question marks to get the source code (which
includes the documentation).

For example,

  sage: lagrange_polynomial??

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Running Sage through Apache2 with Reverse Proxy

2015-08-07 Thread Michael Waters
Has anyone figured this out yet?  I'm having the exact same problem, 
setting up multiple reverse proxies.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Running Sage through Apache2 with Reverse Proxy

2015-08-07 Thread Michael Waters
Hi All -
I'm currently having the exact same problem.  I have a reverse proxy set up 
for RStudio through Apache and it works fine.  However, the reverse proxy 
setup doesn't seem to work for SAGE for the reasons described above.
Has anyone overcome this issue yet?
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: sage server

2015-08-07 Thread Michael Waters
Keeping this thread alive...I'm having the same difficulties. Any global fix 
here?

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Interpolation in Sage

2015-07-22 Thread Michael Orlitzky
On 07/22/2015 04:04 PM, Santanu Sarkar wrote:
 Hello,
I want to find a polynomial f(x_1,x_2,x_3,x_4) explicitly
 by interpolation. I know that the degree of f is 2. I have enough data
 points.  How can I do this in Sage?
 

I have some code to do this here:

http://michael.orlitzky.com/git/?p=sage.d.git;a=blob;f=mjo/interpolation.py

It has sage-style tests and examples. Here's a simple example
interpolating something that looks like f(x) = x^3:

sage: xs = [-2,-1,0,1,2]
sage: ys = [-8,-1,0,1,8]
sage: f = lagrange_polynomial(x, xs, ys)
sage: f
1/3*(x + 2)*(x + 1)*(x - 1)*x - 1/6*(x + 2)*(x + 1)*(x - 2)*x + 1/6*(x +
2)*(x - 1)*(x - 2)*x - 1/3*(x + 1)*(x - 1)*(x - 2)*x
sage: f(x = -2)
-8
sage: f(x = -1)
-1
sage: f(x = 0)
0
sage: f(x = 1)
1
sage: f(x = 2)
8

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Error Installing sage math on redhat-6

2015-06-22 Thread Michael Welsh
 On 22/06/2015, at 1825, Madan Saini cam.ma...@gmail.com wrote:
 
 configure: error: You cannot build Sage as root, switch to a unpriviledged 
 user

This is the error. Run as a non-root user and try again.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] What is wrong with this SAGE function?

2015-06-04 Thread Michael Orlitzky
On 06/04/2015 05:53 PM, Phoenix wrote:
 
 Thanks!
 
 Is there otherwise any standard operation in SAGE to create such vectors?
 

If the construction isn't too complicated, a list comprehension
usually suffices. This will do what you want, I think:

  def elem(i,n):
  return [ ZZ(i == j) for j in range(0,n) ]

A list comprehension is written much like the usual math notation for
set construction, so nothing to be afraid of.


 Given a vector $v$ and a matrix $A$ of dimension $n$, one would say that 
 $v$ is a cyclic vector of $A$ if the following set is linearly independent 
 $\{ v,Av,A^2v,..,A^{n-1}v \}$. 
 
 Is there a way to test this property on SAGE given a $v$ and a $A$?  
 

Sure, using list comprehensions again. First we construct the list of
A(v), A^2(v), etc. Then we stick those vectors in a big matrix, and ask
for its rank. If the matrix has full rank, it's columns/rows are
independent.


  def f(A,v):
  M = matrix([ (A^j)*v for j in range(0,len(v)) ])
  return M.rank() == len(v)

Note that you will need to pass that function a vector (that you get
from calling vector() on a list), not a list. For example,

  sage: A = matrix([[1,2],[3,4]])
  sage: v = vector([1,2])
  sage: f(A,v)
  True

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Decimal Answers

2015-05-11 Thread Michael Orlitzky
On 05/11/2015 03:40 PM, Selah Bryce wrote:
 Thank you. It gave me 9.13877574435632e10. What does that mean?
 

It means 9.13877574435632 times 10^10, or 91387757443.5632.

The e10 at the end is scientific notation. I don't know where the 'e'
came from, but I would guess it stands for exponent and I would bet we
use 'e' because there was no way to write a superscript when hand-held
calculators were invented.

In any case, e10 means move the decimal point 10 places to the right.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] difference between SR.symbol and SR.var

2015-04-10 Thread Michael Orlitzky
On 04/10/2015 05:09 PM, Daniel Krenn wrote:
 Can someone explain me the difference between SR.symbol and SR.var ?
 
 (BTW: SR.symbol does not have a description)
 

SR.symbol is faster, but only lets you declare one variable at a time.
SR.var will parse a string, so something like SR.var('x,y') will work,
but it's a tiny bit slower (thanks to the parsing).


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: How to turn off colored prompt?

2015-02-06 Thread Michael Orlitzky
On 02/06/2015 08:49 PM, P Purkayastha wrote:
 The colors are controlled by ipython. You can run the following to create a 
 default profile and get the path to the configuration file
 
 ~» sage -ipython profile create default
 
 Inside the file there is a color configuration. See this website for the 
 three settings that they have:
 http://ipython.org/ipython-doc/rel-0.10.2/html/config/initial_config.html#color
 

The way I've settled on is to add,

  %colors NoColor

to my ~/.sage/init.sage. That way I don't have to know the gory details
of ipython.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Real symbolic variable

2015-01-29 Thread Michael Orlitzky
On 01/29/2015 06:14 PM, Christophe Bal wrote:
 Hello.
 
 Indeed, I just want to define complex number via the algebraic form z=a+i*b.
 
 expr.simplify_real() will be a great tool. I will be patient...
 
 

It's actually already there, but at moment all you'll get out of it is
abs(x) == sqrt(x^2). It's also safe to call simplify_full() on a real
symbolic variable -- simplify_real() will contain only those
simplifications that *aren't* safe for complex numbers.

I've tried to do something similar before with multiple real
coefficients; something like z = a + i*b + j*c + ... + k*m. It got ugly
real quick, and depending on the operations I was doing, sage wasn't
always able to group the results by i,j,k, etc. Since you only need two
dimensions, you might try using symbolic matrices containing real
variables instead:

  a + b*i ~ [a, -b]
[b,  a]

You can do complex arithmetic using matrix operations, but you'll always
know that the entries of the matrices are real so you can call
simplify_real/full() on them.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Real symbolic variable

2015-01-29 Thread Michael Orlitzky
On 01/28/2015 03:56 PM, Christophe Bal wrote:
 Hello.
 
 How can I define a symbolic variable that is a real number ? Therer is an
 optional argument real in the latest versions of Sympy but this not work in
 Sage.
 

There isn't much support for declaring a variable real in Sage. By
default every variable is complex, but there are some operations that
will treat them as real.

We have three ways to declare a variable real but they're all weird:

  * assume(x, 'real')
  * x = SR.var('x', domain='real')
  * Set the maxima simplification domain to real through some backdoor

I don't know what (if anything) the second one does. The first allows
Maxima to make some simplifications it otherwise couldn't. The third
lets sqrt(x^2) be equal to abs(x) but there's no easy way to do it. And
even though #1 and #3 both use Maxima, #3 doesn't imply #1.

In the next release you'll be able to do expr.simplify_real() and have
it do #1 #2 and #3 all at once along with simplify_log().

So really what we need to know is, why do you want to declare a real
variable? You might be better served by a polynomial ring or some linear
algebra thing.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to close a plot.

2015-01-29 Thread Michael Orlitzky
On 01/28/2015 10:27 AM, Volker Braun wrote:
 On Wednesday, January 28, 2015 at 4:18:50 PM UTC+1, kcrisman wrote:
 Does anyone think this might be useful to add to the FAQ or documentation 
 (if so, where?)? 
 
 IMHO we should not make any guarantees about the behavior of showing plots 
 besides that a plot is shown. Anything else, like whether or not a 
 temporary file is created, depends on the UI (commandline vs. different 
 notebooks) and is subject to change without notice.
 

The question wasn't really about showing a plot. Basically it was,

  Q: How do I save a plot without showing it?
  A: Use save() instead of show()

The OP asked about closing plots because all of the examples tell you to
use show() to save one.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to define L-series?

2015-01-04 Thread Michael Beeson
I tried to follow Guninski's instructions.   I found eulerprod.py and put 
it in the right directory 
and then I got an error due to not having psage.ellcurve.lseries.helper.
I googled for that file and put it in helper.py but I still get an error. 
 Maybe the file 
needs to have a complicated path matching the module name?  What do I do 
now?


sage: load eulerprod.py

---

ImportError   Traceback (most recent call last)


/Users/beeson/ipython console in module()


/Applications/sage/local/lib/python2.6/site-packages/sage/misc/preparser.pyc 
in load(filename, globals, attach)

   1634 

   1635 if fpath.endswith('.py'):

- 1636 execfile(fpath, globals)

   1637 elif fpath.endswith('.sage'):

   1638 if (attach and attach_debug_mode) or ((not attach) and 
load_debug_mode):


/Users/beeson/eulerprod.py in module()

  4 from sage.rings.all import is_RationalField, ZZ, Integer, QQ, O, 
ComplexField, CDF, primes, infinity as oo

  5 from sage.schemes.elliptic_curves.ell_generic import 
is_EllipticCurve

 6 from psage.ellcurve.lseries.helper import 
extend_multiplicatively_generic

  7 from sage.misc.all import prod

  8 from sage.modular.abvar.abvar import is_ModularAbelianVariety


ImportError: No module named psage.ellcurve.lseries.helper

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] plot command doesn't work from a function

2014-11-03 Thread Michael Beeson


sage: def testPlot():

: u = [[1,2],[3,4],[5,7]]

: list_plot(u)

: 

sage: testPlot()

sage: 


doesn't produce any plot,  but executing the body of the function directly 
at the sage prompt does produce a plot.
What am I doing wrong?




-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Pell's equation

2014-11-02 Thread Michael Beeson
This question was simply a result of my misreading the example on page 93, 
where it says

We first solve Pell's equation x2  5y2 = 1 with d = 5 by nding the units 
of

the ring of integers of Q(sqrt(5) using Sage.  Of course I should have 
realized

that just finding those units will give me the solutions of x^2 - 5 y^2 = 
plus or minus 1, not just 1.

I'm sorry for taking your time to point that out.

On Friday, October 31, 2014 9:14:02 AM UTC-7, Michael Beeson wrote:

 Here I attempt to solve Pell's equation with d = 1621 following the method 
 on page 93 of Stein's book.
 But the solution produced is instead a solution of the negative Pell 
 equation x^2-y^2 = -1  (instead of 1).
 Actually, the example on page 93 (after correcting the typo v to u) 
 has the same problem:  it claims 
 that [-2,1]  solves Pell's equation with d=5,  whereas, it really solves 
 the negative Pell equation.

 sage: K.a = QuadraticField(1621)
 sage: G = K.unit_group()
 sage: u = G.1
 sage: L = [list(u^i) for i in [0..3]]
 sage: L
 [[1, 0], [4823622127875/2, 119806883557/2], [23267330432525342852015627/2, 
 577903134597288688851375/2], [56116404965454319198851772383057215250, 
 1393793173905903098261469193463230841]]
 sage: x = L[2][0];
 sage: y = L[2][1];
 sage: x
 23267330432525342852015627/2
 sage: x = L[3][0];
 sage: y = L[3][1];
 sage: x
 56116404965454319198851772383057215250
 sage: y
 1393793173905903098261469193463230841
 sage: x^2-1621*y^2
 -1




-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Pell's equation

2014-10-31 Thread Michael Beeson
Here I attempt to solve Pell's equation with d = 1621 following the method 
on page 93 of Stein's book.
But the solution produced is instead a solution of the negative Pell 
equation x^2-y^2 = -1  (instead of 1).
Actually, the example on page 93 (after correcting the typo v to u) has 
the same problem:  it claims 
that [-2,1]  solves Pell's equation with d=5,  whereas, it really solves 
the negative Pell equation.

sage: K.a = QuadraticField(1621)
sage: G = K.unit_group()
sage: u = G.1
sage: L = [list(u^i) for i in [0..3]]
sage: L
[[1, 0], [4823622127875/2, 119806883557/2], [23267330432525342852015627/2, 
577903134597288688851375/2], [56116404965454319198851772383057215250, 
1393793173905903098261469193463230841]]
sage: x = L[2][0];
sage: y = L[2][1];
sage: x
23267330432525342852015627/2
sage: x = L[3][0];
sage: y = L[3][1];
sage: x
56116404965454319198851772383057215250
sage: y
1393793173905903098261469193463230841
sage: x^2-1621*y^2
-1


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to create and use lists of variables?

2014-10-29 Thread Michael Orlitzky
On 10/28/2014 10:47 PM, smohamm...@gmail.com wrote:
 Thank you so much! I'm sorry I couldn't answer earlier. It worked as I
 expected. Now as the last question on this discussion, do I need to use
 'SymbolicSequence', when I want to numerically solve a large ODE system?
 I tried to use instructions in Solving ODE numerically by GSL from the
 Documentation, but I have encountered some unexpected 'Value Error'(s).
 Of course I know I should ask about them in a separate discussion (and
 I'll do it right after this post!), but here I want to know if it is
 beneficial (or even possible) to do such computations using
 'SymbolicSequence'.

SymbolSequence is just syntactic sugar over the usual symbols you'd get
with e.g. SR.var(), so there shouldn't be any unnecessary limitations.

But I'm not familiar with what you're trying to do, so you're going to
have to let us know what that ValueError is that you're getting.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Spectral decomposition / factorization

2014-10-29 Thread Michael Orlitzky
I have a symmetric real matrix 'A', and I need to factorize it as
X(X^T). An n-by-k X where k=rank(A) would be ideal, but a square X with
zeros is fine too.

Is there a built-in method I'm not seeing? Or something simpler than
looping through the eigenvectors?

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to create and use lists of variables?

2014-10-25 Thread Michael Orlitzky
On 10/25/2014 11:40 PM, smohamm...@gmail.com wrote:
 Thank you Michael, I loaded the file and succeeded to make a list of
 symbols. But now and after evaluating my  expression in terms of its
 elements, how should I assign them different values I want the
 expression to be calculated for? (see a part of my code above, it may
 illustrate what I mean)
 Assigning X[1]=0, results to an attribute error:
 
 AttributeError: SymbolSequence instance has no attribute '__setitem__'

You have to substitute the values into the expression -- just setting
the value of the variable to something else won't actually affect the
expression. I know that sounds confusing. Here's a simpler example of
what I mean without the list of symbols:

  sage: x = SR.var('x')
  sage: f = x^2 + 1

At this point, f is a symbolic expression, in terms of some other
symbolic expression x. We can substitute certain values of x into
f to see how it would evaluate:

  sage: f(x = 3)
  10

But setting the value of x doesn't change what f is:

  sage: x = 3
  sage: f
  x^2 + 1

The sequences should work the same:

  sage: x = SymbolSequence('x')
  sage: f = x[1]^2 + x[2]
  sage: f
  x_1^2 + x_2
  sage: f(x_1 = 3)
  x_2 + 9
  sage: f(x_1 = 3, x_2 = 1)
  10

If you want to substitute a whole bunch of things at once
programmatically, you may need to use a dictionary. Suppose I want to
make a big matrix but I don't want to decide on the size or entries
beforehand (i.e. I need to do it at runtime).

  sage: d = 5
  sage: X = matrix(SR, d, d, x[0:d,0:d])
  sage: X
  [x_0_0 x_0_1 x_0_2 x_0_3 x_0_4]
  [x_1_0 x_1_1 x_1_2 x_1_3 x_1_4]
  [x_2_0 x_2_1 x_2_2 x_2_3 x_2_4]
  [x_3_0 x_3_1 x_3_2 x_3_3 x_3_4]
  [x_4_0 x_4_1 x_4_2 x_4_3 x_4_4]

Whe. Now I want to substitute for those values. I can't hard-code
X(x_0_0 = 0, x_0_1 = 1, ...) since I don't know how many there are
beforehand. But I can make a list of them!

  sage: substitutions=[ (x[i,j], i+j) for i in range(0,d)
  :   for j in range(0,d) ]
  sage: substitutions
  [(x_0_0, 0),
   (x_0_1, 1),
   (x_0_2, 2),
   (x_0_3, 3),
   (x_0_4, 4),
   (x_1_0, 1),
   (x_1_1, 2),
   (x_1_2, 3),
   (x_1_3, 4),
   (x_1_4, 5),
   (x_2_0, 2),
   (x_2_1, 3),
   (x_2_2, 4),
   (x_2_3, 5),
   (x_2_4, 6),
   (x_3_0, 3),
   (x_3_1, 4),
   (x_3_2, 5),
   (x_3_3, 6),
   (x_3_4, 7),
   (x_4_0, 4),
   (x_4_1, 5),
   (x_4_2, 6),
   (x_4_3, 7),
   (x_4_4, 8)]

Wh. Now all I need to do is turn that into a dictionary.
One more time:

  sage: subs_dict = dict(substitutions)
  sage: subs_dict
  {x_2_2: 4,
   x_0_0: 0,
   x_1_3: 4,
   x_4_0: 4,
   x_4_4: 8,
   x_1_0: 1,
   x_0_1: 1,
   x_4_1: 5,
   x_3_2: 5,
   x_2_3: 5,
   x_4_2: 6,
   x_1_4: 5,
   x_2_0: 2,
   x_3_3: 6,
   x_1_1: 2,
   x_0_4: 4,
   x_0_2: 2,
   x_2_1: 3,
   x_2_4: 6,
   x_4_3: 7,
   x_3_0: 3,
   x_3_4: 7,
   x_1_2: 3,
   x_3_1: 4,
   x_0_3: 3}

Finally, we can pass that dictionary as an argument to subs which
performs substitutions on expressions, matrices, and some other things.

  sage: X.subs(subs_dict)
  [0 1 2 3 4]
  [1 2 3 4 5]
  [2 3 4 5 6]
  [3 4 5 6 7]
  [4 5 6 7 8]

Cool, right? Did you ever realize that your example was way too big and
just keep going anyway? So basically,

  * You have to use substitution to stick values into expressions.

  * If you need to do programmatic substitution, a python dictionary
(dict) is often the way to go.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How to create and use lists of variables?

2014-10-24 Thread Michael Orlitzky
On 10/22/2014 01:22 PM, smohamm...@gmail.com wrote:
 Hello to every one,
 I am a *primitive *sage user and I want to produce a function of n
 variables (|x[1],x[2],...,x[n]|), in nested 'for' loops. I've searched
 in sage's documentation, but I have still 2 problems:
 1. How to define a list of variables, such that I can use its items, as
 independent variables, in loops. The loops are needed because the
 function is made up of sums of multiplications of clauses of these
 variables?

This isn't built in, but you can use the attached file to do it. There
are detailed examples in the docstring, but basically you load the file
and then create a SymbolSequence object with the name you want:

  sage: load('symbol_sequence.py')
  sage: x = SymbolSequence('x')
  sage: x[0]
  x_0
  sage: x[1]
  x_1
  sage: x[10]
  x_10

Multiple subscripts and slices also work the way you'd want them to (I
hope).


 2. How to simplify the result of loops according to some extra
 conditions, such as |x[i]^2==1| ?

We have the assume function, which can do things like,

  sage: assume(x^2 == 1)

but I don't want to get your hopes up. Even with that assumption, the
expression x^2 won't simplify:

  sage: (x^2).simplify_full()
  x^2

For other equations, it might help though.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
from sage.all import *

class SymbolSequence:

An iterable object which acts like a sequence of symbolic
expressions (variables).

INPUT:

  - ``name`` -- The sequence name. For example, if you name the
sequence `x`, the variables will be called `x_0`, `x_1`,...

  - ``latex_name`` -- An optional latex expression (string) to
use instead of `name` when converting the symbols to latex.

  - ``domain`` -- A string representing the domain of the symbol,
either 'real', 'complex', or 'positive'.

OUTPUT:

An iterable object containing symbolic expressions.

EXAMPLES:

The simplest use case::

sage: a = SymbolSequence('a')
sage: a[0]
a_0
sage: a[1]
a_1

Create polynomials with symbolic coefficients of arbitrary
degree::

sage: a = SymbolSequence('a')
sage: p = sum([ a[i]*x^i for i in range(0,5)])
sage: p
a_4*x^4 + a_3*x^3 + a_2*x^2 + a_1*x + a_0

Using a different latex name since 'lambda' is reserved::

sage: l = SymbolSequence('l', '\lambda')
sage: l[0]
l_0
sage: latex(l[0])
\lambda_{0}

Using multiple indices::

sage: a = SymbolSequence('a')
sage: a[0,1,2]
a_0_1_2
sage: latex(a[0,1,2])
a_{0}_{1}_{2}
sage: [ a[i,j] for i in range(0,2) for j in range(0,2) ]
[a_0_0, a_0_1, a_1_0, a_1_1]

You can pass slices instead of integers to obtain a list of
symbols::

sage: a = SymbolSequence('a')
sage: a[5:7]
[a_5, a_6]

This even works for the second, third, etc. indices::

sage: a = SymbolSequence('a')
sage: a[0:2, 0:2]
[a_0_0, a_0_1, a_1_0, a_1_1]

TESTS:

We shouldn't overwrite variables in the global namespace::

sage: a = SymbolSequence('a')
sage: a_0 = 4
sage: a[0]
a_0
sage: a_0
4

The symbol at a given index should always be the same, even when
the symbols themselves are unnamed. We store the string
representation and compare because the output is unpredictable::

sage: a = SymbolSequence()
sage: a0str = str(a[0])
sage: str(a[0]) == a0str
True

Slices and single indices work when combined::

sage: a = SymbolSequence('a')
sage: a[3, 0:2]
[a_3_0, a_3_1]
sage: a[0:2, 3]
[a_0_3, a_1_3]



def __init__(self, name=None, latex_name=None, domain=None):
# We store a dict of already-created symbols so that we don't
# recreate a symbol which already exists. This is especially
# helpful when using unnamed variables, if you want e.g. a[0]
# to return the same variable each time.
self._symbols = {}

self._name = name
self._latex_name = latex_name
self._domain = domain


def _create_symbol_(self, subscript):

Return a symbol with the given subscript. Creates the
appropriate name and latex_name before delegating to
SR.symbol().

EXAMPLES::

sage: a = SymbolSequence('a', 'alpha', 'real')
sage: a_1 = a._create_symbol_(1)
sage: a_1
a_1
sage: latex(a_1)
  

Re: [sage-support] Re: Strange characters in sage terminal

2014-08-18 Thread Michael Orlitzky
On 08/18/2014 04:05 PM, Oscar Lazo wrote:
 Yes, I ran uxterm and I still see strange characters there. Any ideas?
 
 Thank you,
 

You also need to be using a font which supplies those glyphs. I think
the DejaVu family should have them if you want to test using that.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Correct way to define vector function

2014-08-09 Thread Michael Gass
Is there a difference between the following ways to define a vector

v = vector([1, 2, 2])

v = vector((1, 2, 3))  # double parentheses

Both seem to work.  Similarly for vector functions, is there a difference 
between

w = vector([ cos(t), sin(t), t ])

w = vector(( cos(t), sin(t), t ))  # double parentheses

Both work with parametric_plot, but various sources say to use double 
parentheses when defining a vector function.

Is there a difference?

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] error in sage build

2014-06-26 Thread michael kaepernik
after downloading source tarball, the tarball was extracted and moved into 
a new directory i created for the build /home/me/sage_build  

this is in openSUSE 13.1 btw

so after cd /home/mike/sage_build/sage-6.2
make leaves me with the following error:

Error building Sage.

The following package(s) may have failed to build:

The build directory may contain configuration files and other potentially
helpful information. WARNING: if you now run 'make' again, the build
directory will, by default, be deleted. Set the environment variable
SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.

make: *** [build] Error 1.


any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Options for the Sage expand function

2014-06-14 Thread Michael Orlitzky
On 06/14/2014 12:43 AM, jeanbigbo...@gmail.com wrote:
 I am coming up to speed on Python, Sympy, and Sage by doing some simple
 problems on all three.  Sympy has an option for its expand function,
 complex=True, that has made some of my expressions easier to read/use.
 I'm working with quotients of complex numbers.  This option allows Sympy
 to return expressions that look like a + bi broadly speaking with nice
 relations for a and b.  With Sage so far, I can't seem to get the
 equivalent level of expansion.
 
 I'd like to ask if there is a way to invoke that complex=True or its
 equivalent within Sage.  I've done a bit of searching but so far the
 answer has not jumped out at me.  I also tried the other support system
 but don't have enough points to post.
 

The sage expand() function doesn't use sympy. However, we have the
ability to send symbolic expressions back and forth between sage and
sympy, so it is possible.

First thing you should do is open a trac ticket with a feature request.
It should be possible to add the complex parameter to the sage
expand() function using sympy.

Second, for a workaround, you can do the following:

  sage: x = SR.symbol('x')
  sage: x._sympy_().expand()
  x
  sage: x._sympy_().expand(complex = True)
  re(x) + I*im(x)

This will give you the *visual* representation that you want, but it
isn't very convenient to work with. It looks like nobody's told sage how
to convert the sympy im() function back into a sage expression yet:

  sage: x._sympy_().expand(complex = True)._sage_()
  ...
  AttributeError: 'im' object has no attribute '_sage_'

This wouldn't be super difficult to do, though; the following already
works in sage:

  sage: x.real_part() + I*x.imag_part()
  I*imag_part(x) + real_part(x)

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Optional GAP packages in Sage 6.2

2014-05-09 Thread Michael Hind
Hi,
I just built Sage 6.2 from source (ex .git) and it brings in GAP 4.7.4.

Now the sage --optional lists
... 
database_gap-4.6.4 .. not installed
...
gap_packages-4.6.4.p1 ... not installed
...

I am not too happy about installing these

I already have GAP 4.7.4 installed on my system.  Is there a way to link to 
this, or conversely get the later versions?

I get this at the moment.

from Sage:

mhh@mhh-Desktop:~$ sage --gap
 ┌───┐   GAP, Version 4.7.4 of 20-Feb-2014 (free software, GPL)
 │  GAP   │   http://www.gap-system.org
 └───┘   Architecture: x86_64-unknown-linux-gnu-gcc-default64
 Libs used:  gmp, readline
 Loading the library and packages ...
 Packages:   GAPDoc 1.5.1
 Try '?help' for help. See also  '?copyright' and  '?authors'
gap quit;

and from GAP

mhh@mhh-Desktop:~/src/gap$ 
./gap   



 ┌───┐   GAP, Version 4.7.4 of 20-Feb-2014 (free software, 
GPL)


 │  GAP   │   
http://www.gap-system.org   

  

 └───┘   Architecture: 
x86_64-unknown-linux-gnu-gcc-default64  



 Libs used:  gmp, 
readline

 

 Loading the library and packages 
... 

 

 Components: trans 1.0, prim 2.1, small* 1.0, id* 
1.0 
 

 Packages:   AClib 1.2, Alnuth 3.0.0, AtlasRep 1.5.0, AutPGrp 1.6, Browse 
1.8.3, Carat 2.1.4, CRISP 1.3.8, Cryst 4.1.12, CrystCat 1.1.6, CTblLib 
1.2.2, FactInt 1.5.3, FGA 1.2.0, GAPDoc 1.5.1, 
 IO 4.2, IRREDSOL 1.2.4, LAGUNA 3.6.4, Polenta 1.3.1, 
Polycyclic 2.11, RadiRoot 2.6, ResClasses 3.3.2, Sophus 1.23, SpinSym 1.5, 
TomLib 1.2.4
 Try '?help' for help. See also  '?copyright' and  '?authors'
gap quit;

I am running Kubuntu 14.04 64bit

BTW how do I avoid: Architecture: x86_64-unknown-linux-gnu-gcc-default64, 
when I build?

Cheers,
Michael

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Zero power zero

2014-04-16 Thread Michael Orlitzky
On 04/16/2014 08:08 AM, Jori Mantysalo wrote:
 print 0^0
 var('n')
 simplify(0^n)
 
 prints
 
 1
 0
 
 Is this a bug or feature?
 

Bug, 0^0 is undefined in Maxima but 0^x is 0.

In Sage we've standardized on 0^0 == 1.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Plotting equation of two perpendicular lines

2014-04-16 Thread Michael Orlitzky
On 04/16/2014 05:35 AM, omid habibi wrote:
 Thanks for reply, Can you tell me how should I change the ratio?
 
 On Wednesday, April 16, 2014 1:40:04 PM UTC+4:30, John Cremona wrote:
 
 For both graphs you have set the x-range to -10..10 but the y-ranges
 are different, and the graph has been scaled so that (as you can see
 from the axes) the aspect ratio is not 1:1.
 
 Try specifying equal y-ranges as well as equal x-ranges.
 

(p1 + p2).show(aspect_ratio=1) should work also if you don't want to
worry about the x/y ranges.


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] bool function fails!?

2014-04-13 Thread Michael Orlitzky
On 04/13/2014 12:16 PM, Daniel Edler wrote:
 I wanted to show that two equations are equal so I used the bool()
 function. Unfortunately sage (6.1.1) do not see that it is equal but
 obviously they are. If I replace log(x) with -log(1/x) it works and the
 replacement itself is also true for sage. What is the problem? Here is
 my cell:
 

When you call bool() on a symbolic equality, there are three potential
results that are returned as only two constants:

  - True: They're equal
  - False: Either they're not equal, or I don't know

In your case, False means I don't know. Sage errs on the safe side
here. You can convince it to try more drastic transformations in order
to determine that they're equal:

  sage: actual = -g*m^2*log(   (m*v*cos(alpha))/(m*v*cos(alpha) - k*x)
  ) /k^2 + m*v*sin(alpha)/k+ g*m^2/k^2 - (m*v*cos(alpha) -
  k*x)*sin(alpha)/(k*cos(alpha)) - (m*v*cos(alpha) -
  k*x)*g*m/(k^2*v*cos(alpha))
  sage: expected = (tan(alpha)+m*g/(k*v*cos(alpha)))*x + g*(m/k)^2 *
  log(1-k*x/(m*v*cos(alpha)))
  sage: bool(actual == expected)
  False
  sage: bool(actual.simplify_full() == expected.simplify_full())
  True

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] SageMath Cloud printing all intermediate input

2014-04-07 Thread Michael Yurko
I've recently started using sagemath cloud as opposed to a local instance of 
the notebook. One big difference I've noticed is that in the cloud version, all 
intermediate output is being printed. However, this is quite annooying when 
trying to make a plot with matplotlib since writing something like 
plt.xlabel('label') will produce output. Is there a way to suppress this an 
get the old behavior of the notebook back?

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] SageMath Cloud printing all intermediate input

2014-04-07 Thread Michael Yurko
Thanks for the reply. I'll look into the display hook a bit then. I've been 
using SMC for a few days now and have been very impressed. I guess this is the 
first regression that I have encountered.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Polynomial question.

2013-12-11 Thread Michael Orlitzky
On 12/11/2013 07:40 AM, Thierry Dumont wrote:
 
 Ok, this is correct, and seems nice; but I want to evaluate these
 polynomials for  different values of x, and you cannot evaluate a member
 of Integer Ring at say, x=1/21... So I need to compute the parent of
 polynomials (which possibly are scalars)  in all my functions, make test
 and so on
 

This and more fixed in,

  http://trac.sagemath.org/ticket/13720

I've just rebased the patch on top of the git version, and hopefully
addressed the last two technical concerns.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-support] -~$ sage No command 'sage' found

2013-10-31 Thread michael kaepernik


On Monday, October 14, 2013 11:27:24 AM UTC-4, Jan Groenewald wrote:

 Hi Michael,

 Run this command (cut and paste it all on one line) to set an alias 
 permanently pointing at the rigth path:

 echo alias 
 sage=$HOME/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/sage  
 ~/.bashrc

 And read it into the current terminal with:

 source ~/.bashrc

 Regards,
 Jan




 On 14 October 2013 16:48, michael kaepernik alienfe...@gmail.comjavascript:
  wrote:

 sage 5.11 pre-compiled binary was downloaded onto ubuntu 13.04 but when 
 the command 'sage' is entered in /home/kappy the error ~$ sage
 No command 'sage' found, did you mean:
  Command 'page' from package 'tcllib' (universe)
  Command 'save' from package 'atfs' (universe)
  Command 'osage' from package 'graphviz' (main)
 sage: command not found

 when i change directory to /home/sage and the command 'sage' is entered 
 the error 
 ~/sage$ sage
 No command 'sage' found, did you mean:
  Command 'page' from package 'tcllib' (universe)
  Command 'save' from package 'atfs' (universe)
  Command 'osage' from package 'graphviz' (main)~/sage$ ls
 sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux
 sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux.tar.lzma
 sage: command not found
 mike@mike-1001PX:~/sage$ 

 is returned.  this is the contents of the directories:
 ~/sage$ ls
 sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux
 sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux.tar.lzma

 and; 

 :~/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux$ ls
 COPYING.txt  data  devel  local  Makefile  README.txt  sage  spkg 
  VERSION.txt
  
 so it seems all of the files were extracted from the tarball (?).  any 
 suggestions would help
 -thanks

 -- 
 You received this message because you are subscribed to the Google Groups 
 sage-support group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sage-support...@googlegroups.com javascript:.
 To post to this group, send email to sage-s...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/sage-support.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
   .~. 
   /V\ Jan Groenewald
  /( )\www.aims.ac.za
  ^^-^^ 



actually, nm.  i figured it out.  now i can call up sage in any directory 
using just the command sage.  if anyone else was not sure how this worked, 
this is what i did 

  alias sage= /home/mike/sage-5.12/./sage 

the alias command assigns an alias, here i decided to use sage, or sets it 
rather to the command that i am abreviating.  that is instead of typing 

 /home/mike/sage-5.12/./sage

after defining 'sage' with the alias, now my bash sees them as equivalent. 
 forest through the trees.  thanks all

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-support] -~$ sage No command 'sage' found

2013-10-30 Thread michael kaepernik


On Monday, October 14, 2013 11:27:24 AM UTC-4, Jan Groenewald wrote:

 Hi Michael,

 Run this command (cut and paste it all on one line) to set an alias 
 permanently pointing at the rigth path:

 echo alias 
 sage=$HOME/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/sage  
 ~/.bashrc

 And read it into the current terminal with:

 source ~/.bashrc

 Regards,
 Jan




 On 14 October 2013 16:48, michael kaepernik alienfe...@gmail.comjavascript:
  wrote:

 sage 5.11 pre-compiled binary was downloaded onto ubuntu 13.04 but when 
 the command 'sage' is entered in /home/kappy the error ~$ sage
 No command 'sage' found, did you mean:
  Command 'page' from package 'tcllib' (universe)
  Command 'save' from package 'atfs' (universe)
  Command 'osage' from package 'graphviz' (main)
 sage: command not found

 when i change directory to /home/sage and the command 'sage' is entered 
 the error 
 ~/sage$ sage
 No command 'sage' found, did you mean:
  Command 'page' from package 'tcllib' (universe)
  Command 'save' from package 'atfs' (universe)
  Command 'osage' from package 'graphviz' (main)~/sage$ ls
 sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux
 sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux.tar.lzma
 sage: command not found
 mike@mike-1001PX:~/sage$ 

 is returned.  this is the contents of the directories:
 ~/sage$ ls
 sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux
 sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux.tar.lzma

 and; 

 :~/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux$ ls
 COPYING.txt  data  devel  local  Makefile  README.txt  sage  spkg 
  VERSION.txt
  
 so it seems all of the files were extracted from the tarball (?).  any 
 suggestions would help
 -thanks

 -- 
 You received this message because you are subscribed to the Google Groups 
 sage-support group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sage-support...@googlegroups.com javascript:.
 To post to this group, send email to sage-s...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/sage-support.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
   .~. 
   /V\ Jan Groenewald
  /( )\www.aims.ac.za



jan, 

thank you for your reply.  before you did however, i compiled sage from 
source and it has since worked fine. 
however, towards your suggestion i have tried to, i think, redefine the 
path variable (?) so that whenever i type sage in my terminal it would open 
sage.  right now, i have to cd directories and type the command ./sage.  no 
big deal, not a real problem.  but i did want to take your advice so that i 
could just type sage and call it up from any directory.  
so i followed your advice, copied and pasted and these were the results;

mike@mike-1001PX:~$ echo alias 
sage=$HOME/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/sage  
~/.bashrc
mike@mike-1001PX:~$ source ~/.bashrc
mike@mike-1001PX:~$ ./sage
bash: ./sage: No such file or directory

 mike@mike-1001PX:~$ alias 
sage=$HOME/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/sage
mike@mike-1001PX:~$ source ~/.bashrc
mike@mike-1001PX:~$ sage
bash: /home/mike/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/sage: 
No such file or directory

mike@mike-1001PX:~$ ./sage
bash: ./sage: No such file or directory

mike@mike-1001PX:~$ sage
bash: /home/mike/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/sage: 
No such file or directory

mike@mike-1001PX:~$ echo alias 
sage=$HOME/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/sage  
~/.bashrc
mike@mike-1001PX:~$ source ~/.bashrc
mike@mike-1001PX:~$ 
mike@mike-1001PX:~$ sage
bash: /home/mike/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/sage: 
No such file or directory

mike@mike-1001PX:~$ ./sage
bash: ./sage: No such file or directory

mike@mike-1001PX:~$ /.sage
bash: /.sage: No such file or directory


so what am i doing wrong?
thanks in advance


  ^^-^^ 
  

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-support] Sage on Mavericks requesting installation of X

2013-10-29 Thread Michael Welsh

On 30/10/2013, at 0945, Ed Scheinerman edward.scheiner...@gmail.com wrote:

 Update: I re-installed XQuartz and the problem vanished. 

Was this the first time you re-installed KQuartz after installing Mavericks?

Apple requires such a thing with every new major OS X upgrade, I do believe.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Live Tutorials in Sage 5.12 (VirtualBox VM)

2013-10-28 Thread Michael Shea
I just installed Sage 5.12 (VirtualBox VM) a couple of days ago. I can't 
get the Live Tutorials to work.  For the Sage Notebook page I click Help 
then Tutorials and get the error Server error
The website encountered an error while retrieving 
http://localhost:8000/doc/live/tutorial/index.html. It may be down for 
maintenance or configured incorrectly.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] -~$ sage No command 'sage' found

2013-10-14 Thread michael kaepernik
sage 5.11 pre-compiled binary was downloaded onto ubuntu 13.04 but when the 
command 'sage' is entered in /home/kappy the error ~$ sage
No command 'sage' found, did you mean:
 Command 'page' from package 'tcllib' (universe)
 Command 'save' from package 'atfs' (universe)
 Command 'osage' from package 'graphviz' (main)
sage: command not found

when i change directory to /home/sage and the command 'sage' is entered the 
error 
~/sage$ sage
No command 'sage' found, did you mean:
 Command 'page' from package 'tcllib' (universe)
 Command 'save' from package 'atfs' (universe)
 Command 'osage' from package 'graphviz' (main)~/sage$ ls
sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux
sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux.tar.lzma
sage: command not found
mike@mike-1001PX:~/sage$ 

is returned.  this is the contents of the directories:
~/sage$ ls
sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux
sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux.tar.lzma

and; 

:~/sage/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux$ ls
COPYING.txt  data  devel  local  Makefile  README.txt  sage  spkg 
 VERSION.txt

so it seems all of the files were extracted from the tarball (?).  any 
suggestions would help
-thanks

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


  1   2   3   4   >