Hello everyone,
I must declare assume twice. First time, I get an unevalued form.
After the second assume, I get the fine result :
I use Sage 5.7
sage: forget () ; var('n')
n
sage: assume ((x1) and (x0)) ; limit (n*x^n*(1-x), n=oo) ; limit
(n*x^n*(1-x), n=oo)
-(x - 1)*limit(x^n*n, n,
Hello,
A map command seems also right :
sage: [f0, f1] = map (lambda n: lambda x: bessel_J(n,x),[0,1]) ;
f0(0);f1(0)
1.00
0.000
In the command [lambda x: n*x for n in [0..1]] there is a variable n in
the for list,
and questions about its value (a dalayed
John Cremona describes an use of the algebraic QQbar domain :
Then I test
a=sqrt(2)-sqrt(3)
b=sqrt(3)-sqrt(2)
QQbar(a).minpoly() ; QQbar(b).minpoly() # seems right. The same even
polynom.
But the test and the numerical values are True. I get +0.31 in both cases.
QQbar(a)==QQbar(b)
This
What do you think about the format % operator :
add([var(x%02d % k) for k in [0..11]])# creates 11 variables x00
to x11, and adds it
v1=vector ([var(x%02d % k) for k in [0..11]])
v2=vector ([var(x%02d % k) for k in [0..11]])
v1==v2 # is true.
--
To post to this group, send email to
ObsessiveMathsFreak wrote :
I have complex formulas involving several occurances of complex
exponentials. e.g. e^(2*I*theta), e^(3*I*theta)
I would like to find the real part of the expression (there are
several variables), but when I do so, the expression becomes unwieldy
with a lot of terms
Dmitry Shkirmanov a écrit :
Hello, list, i need a function that can exp(I*x) -- cos(x)+I*sin(x)
At http://wiki.sagemath.org/symbolics/rewrite i found the rewrite
function. But this function is not mentioned in Sage reference manual,
and Sage 4.6.2 does not know this function:
NameError: name
achrzesz wrote :
SAGE:
sage: s=solve(3*x^3-9*x+10==0,x,solution_dict=True)
sage: [n(t[x]) for t in s]
[1.06780542232902 - 1.84949324407141*I,
0.0277635108030695 + 1.24902476648341*I,
-1.09556893313209 + 0.600468477588001*I]
# WRONG!
sage: s=solve(3*x^3-9*x+10==0,x,
Andrzej Chrzeszczyk finds this numerical error in this equation :
sage: s=solve(3*x^3-9*x+10,x,solution_dict=True)
sage: ns=[n(s[k][x]) for k in range(3)]
sage: ns
[1.06780542232902 - 1.84949324407141*I,
0.0277635108030695 + 1.24902476648341*I,
-1.09556893313209 + 0.600468477588001*I]
achrzesz wrote :
sage: s=solve(3*x^3-9*x+10,x,solution_dict=True)
sage: ns=[n(s[k][x]) for k in range(3)]
sage: ns
[1.06780542232902 - 1.84949324407141*I, 0.0277635108030695 +
1.24902476648341*I, -1.09556893313209 +
0.600468477588001*I] # no real solution, no conjugate
solutions
Santanu Sarkar a écrit :
How one can find integral abs(cos(x+y)) where x varies from 0 to pi
and y varies from 0 to pi in Sage?
You must help Sage (in fact Maxima bellow) for these integrals.
cos(x+y) = 0 for 0 = x+y = pi/2 or 3*pi/2 = x+y = 2*pi
cos(x+y) = 0 for pi/2 = x+y = 3*pi/2
First
Again...
Look at diff code by differentiate??, You read at the end of the file
that sage call derivative.
Search in x.derivative?? , there is a methode x._derivative??
I feel that only sage manages the rewrite rules in diff.
Now browse into taylor?? source, and you see that sage call the
Dear Martin,
Many thanks for these explanations...
They point exactly what I was looking for.
a very last question : Is there a link between
ring structure GF(2)[a,b,c] / (a^2-a, b^2-b, c^2-c) where + == xor and *
== and
and Boolean predicates over variables a, b, c with operators or == |
C. Kelly wrote :
I define the following one-parameter functions and their derivatives
x,y,l,L = var('x,y,l,L')
d5 = function('d5',nargs=1)
def d3partderiv(self,*args,**kwds): arg = args[0]; return
L*L*d5(arg);
d3 = function('d3',derivative_func=d3partderiv)
def
Hello, I came back...
I define the following one-parameter functions and their derivatives
x,y,l,L = var('x,y,l,L')
d5 = function('d5',nargs=1)
def d3partderiv(self,*args,**kwds): arg = args[0]; return
L*L*d5(arg);
d3 = function('d3',derivative_func=d3partderiv)
def
Thomas Gueuning wrote :
When I use this code, I don't understand why y^3 is still there
because I think this is equal to y for both 0 and 1. So why the
Groebner basis is [y^3 + y, x^2 + y^2 + 1, x*y] and not [x+y+1,x*y],
which should be reduced to [x+y+1]. I tried to add a modulus but it
Hello,
I'd like to plot this function of x (latex code):
x/2 + sum_{r=1}^n cos(rx)
for some fixed n.
//A//
First, sum is designed for formal sum, not for truncate sum even if
sometimes it's possible.
But add is designed for these sums.
Second, expression doesn't evaluate the add(...)
Hello Renato,
def s(x,n) :
return x/2 + add (cos(k*x) for k in [1..n])
n0 = 5;
plot(s(x,n0),(x,0,pi))
Thanks for clarification and tips :) Just a last doubt: if I
understand correctly, add() wants as argument an array like for
example [1,2,7,5], but running cos(k*x) for k in [1..n]
Robert Bradshaw wrote :
On Sun, Jan 30, 2011 at 2:55 AM, Loďc xl...@free.fr wrote:
You're right, size affects the center too.
Not very intuituive but now, I know it.
I think this behaviour is quite surprising.
For example, with sphere, size doesn't affect center
I might go so
Renato a écrit :
Hello, I can't understand how the ticks option works in plot()... I
want to have no ticks or labels on the axis.
Also, is it possible to show the arrows on the axis? like this:
http://www.homeschoolmath.net/blog/few-complex-numbers.gif
I'm using latest version of sage
Hello,
I was making some tries with 3D.
I don't succeed to make cube correctly:
Here is my code:
c=cube((0,0,0),size=2,opacity=0.1,color='red')
c+=point((2/3,2/3,0),color='green',size=10)
c+=cube(center=(2/3,2/3,0),size=1/3,opacity=0.8)
show(c)
I draw a point with coord (2/3,2/3,0)
Then I draw
Loďc a écrit :
Hello list,
Version: sage 4.6.1
I'm quite a newbie with Sage but I'm really impressed this powerful
software.
Since an hour, I'm on a stupid problem:
sage: sqrt(2)*sqrt(3)
sqrt(2)*sqrt(3)
sage: sqrt(2)*sqrt(3)-sqrt(6)
sqrt(2)*sqrt(3)-sqrt(6)
Test :
sage
Jason Grout wrote :
And maybe also a reason for us to make things more discoverable.
For example, I think changing M.apply_map() to M.map() would make it
much easier to discover
(or at least making M.map() an alias of M.apply_map()).
Indeed I also don't think to look at matrix.apply_map()
Hello,
Any chance that we can add simplify_full on matrices? So that each
element is simplified if possible?
/1/ I suppose you know the map function that operate over each term of a
list.
map (lambda x: 3*x, [1,2,3]) # computes [3,6,9]
# you can replace 3*x by the function
thanks,
I discover :
sage: import itertools
sage: it = sxrange(10^7)
sage: (it1, it2) = itertools.tee (it)
sage: ... play with it1.next() and it2.next()
...
F.
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
Hello,
I play with the famous timeit function.
I don't understand if this function sends a result or only gives a
displayed text.
I test :
timeit ('2+3') # In these 2 cases Sage displays
625 loops...
res=timeit ('2+3) # the res variable contains None.
Hello,
I try to work with all the subsets of a cartesian product.
So I begin with
S = Set([1..4])
P = CartesianProduct (S)
Subsets (S) # is right
Subsets (P) # fails
Am I wrong ? (CartesianProduct isn't a Set) or is it a bug in Sage ?
Many thanks for your tips.
Francois
--
To post to this
Cristóvão wrote :
I propose a generic function mapexpression in order operate in the tree
of the expression.
You can use it over leaf (ie the numbers or the variables) or over
functions (by the fctfct parameter)
I like this function because we can use this same function for numerical
Jason Grout wrote :
range() is a python function that creates python ints, which actually
are arbitrarily big:
and type changes around 2^31 :
type (int (2^30)) == type 'int'
type (int (2^32)) == type 'long'
Thanks for all your tips, you are my teacher !
François
--
To post to this group,
vasu wrote :
Hi all
Suppose I have an positive integer parameter 't', and a polynomial
Delta(t) , which is a polynomial in 't' with coefficients being
integers. Assume we also know that Delta(t) 0.
There is another polynomial with integer coefficients , say F(t).
Consider an expression
Rolandb wrote :
test=((k2,k1) for k1 in xrange(2,4) for k2 in xrange(1,k1) if gcd(k1,k2)==1)
print [t for t in test]
print [t for t in test]
[(1, 2), (1, 3), (2, 3)]
[]
I begun to confuse lists L with [...] we can free change :
one change one term by L[1]=123, and change the length by
Hi Alasdair,
F.x=GF(2^8,name='x')
R.y=PolynomialRing(Zmod(2))
p = F.random_element()
p.subs(x=y)
Basically, I have an object which is created as an element of a finite
field, which I then need to treat as an element of a ring. If I try:
pp = p.polynomial()
pp.subs(x=y)
And what do you
Hello,
When I use sage in a xterm I can load a source file with the *.sage name.
sage: load ('In/This/Directory/MyFile.sage') # it's fine with and
without parenthesis
sage: # I continue my sage session
Now I run sage in emacs with the sage-mode.el file.
And with the same command I get an
Hello,
I'm using Sage and try some months ago to plot a very long expression,
and that fails !
(see http://trac.sagemath.org/sage_trac/ticket/7165)
Today I test with the shorter command, and I get a NotANumber answer
with fast_float used by plot.
sage: var ('m') ; rr = abs (sqrt (m^2-1)) ;
Hello,
This bug feels very similar to 7614 (not 7165) and so 5572.
http://trac.sagemath.org/sage_trac/ticket/7165
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support-unsubscr...@googlegroups.com
For more options,
Hello Laurent and Michel ! [Maybe french users...]
I never have any luck with plotting in Sage. The simplest plots fail.
For example the following
plot(20*log(abs((1+I*x)^4+4),10),(x,0,3))
The answer of this
f(x) = abs((1+I*x)**4+4)
f(1)
is 0.
Then the logarithm produces
Hello,
I try to use the 3d plot but I can't.
The first command is perfect.
The second opens no new display and I can continue other calculus after.
I use a sage 4.2 version in a emacs windows in gnome box. The
distribution is an ubuntu.
show( line([(1,2), (1,0), (3,1), (2,1)], color='red'))
This is the right reason :
...with Ubuntu, the right package is
apt-get install icedtea6-plugin
It's perfect.
So Sage contains the other computer algebra systems, but calls other
programs for graphic display.
--
To post to this group, send email to sage-support@googlegroups.com
To
Hello everybody !
I'm using plot :
I can plot a curve by
sage: plot (sin(x), (x,-3,3))
or
sage: res = plot (sin(x), (x,-3,3)) ; res
I also can configure plot with optional parameters.
plot (sin(x), (x,-3,3), aspect_ratio=1)
And aspect_ratio is a method in res : I test it by res.[tab]
But
Hello,
As a first pass, just surround the evaluation with a try/except, as
you would in Python. Perhaps you could set the value in the except
clause to nan.
For the 2d-plot, I test if a result is a real number by theses tests :
#
# The real number without infty nor NaN=NotANumber
Hello,
I'm an old lisp-list user and python is my first use of dynamic array-list.
Complexity for lisp-list is constant and fast o(1) when we add a new
element at the head of the list.
(cons e L) in Lisp or e::L in caml.
Complexity is also o(1) when we take the end of the list, or read the
mpad a écrit :
Hello everyone,
I am new to sage (thanks for it ! it looks excellent !) and have been
trying to re-factor some long expressions.
As an example :
sage: var('x,y,a,b,c,d')
(x, y, a, b, c, d)
sage: T=expand((x^2+y^2)*(a*b+a^2-2*d*c+c^2-3*b^2));T
a^2*x^2 + a^2*y^2 + a*b*x^2 +
Hello everybody !
I run around plot and show and I want to display only a subwindow (x,y)
in [-5,5]x[-5,5] of a plot even if y goes from -oo to +oo.
For parametric_plot I need to cut both the x-axe and the y-axe.
The figsize option doesn't seem the right one :
the display is more or less
Hello,
Hi all,
In sage, as of 4.1.1, binomial( -7, 1 ) returns -7. As I understand the
definition of binomial, this should be 0, since there is no set with -7
elements.
Sage (and others Computer Algebra System) gives 0 for binomial (n=0,
-1) or binomial(n,kn).
So
sum from k=-infty
Hello,
I play with the timeit function because I want to test the asymptotic
time of complexity for (pseudo-)lists in sage.
I test
timeit('n=5;[2*x for x in [1..10^n]]')
This line is well evaluate and I get a linear answer when I change n
from 2 to 7.
I may add the parameter repeat=1 and
Hello wxuyec,
The same expression, How can I want to get
the coefficient of x^4*y?
The coefficient of the coefficient...
try
var('a b x y')
res = expand ((a+b+x+y+1)^6)
res.coefficient (x^4)
res.coefficient (y)
res.coefficient (x^4).coefficient(y)
res.coefficient (y).coefficient(x^4)
Hello,
About this question, I test coefficient and collect.
Is it a bug ? or is there a reason ? collect and coefficient don't have
the same react :
I take a line equation
test = cos(a)*x+sin(a)*y-h # means ... == 0
test.coefficient(cos(a)) # are right
test.coefficient(x)
test.collect(x)
Thanks Mike,
You should check the version of Sage that you are using. The
SymbolicArithmetic class shouldn't exist after Sage 4.0.
I test again this morning, and it's right !
Indeed I have 3 sage(s) in my ubuntu box.
The ubuntu one, an old version, the 4.1.2-a4 and my one with little
Ranjit a écrit :
I'm trying to figure out how to do a simple substitution. I've the
following code:
var('r beta beta_0 R a h')
psi=function('psi',r)
sigma=function('sigma',r)
H_0=function('H_0',r)
H_grad = lambda psi : (1/2)*(beta/beta_0)*R^2*(psi.diff(r))^2
H_0(psi) =
ma...@mendelu.cz wrote :
Hello all, I am looking for the possibility how to simplify each term
in an expression separately.
Consider
A=x/((x^2/y^2 + 1)*y) + arctan(x/y)
I wish to get x*y/(x^2+y^2)+atan(x/y) , which can be produced in
Maxima by map(fullratsimp, A)
I feel this
Hi Burcin,
Many thanks for theses details about sage. I try to understand what you
prefer, and why.
The main reason I left this simplification exp(a)^2 to exp(2*a) while
fixing #6948 was that MMA does things this way.
All right : MMA is good.
Another consideration was that before
Hi,
I get elements inside an expression as res=3*x*exp(x^2) by
res.operands() and res.operator().
So I catch 3 or x or exp(x^2) by res.operands()[0 or 1 or 2].
But how can I test that the first one is an Integer without error ?
The res._interger_() seems to accept to retract the expression
Hello Everybody !
With sage in emacs I test this single function, but I get an error :
def ff (n) :
if n==0 :
return(1)
else :
return(n*ff(n-1))
I type theses lines in a buffer, and I copy by Ctrl-K / Ctrl-Y in
sage-buffer
Then I get this error :
: : :
Many thanks Tim !
If you simply copy-paste into the sage commandline, you will get that
error...
Last time I tried `sage.el`, there was a command to send input
directly to the comandline buffer...
Perfect ! I pass the edited buffer to sage-mode in emacs,
get then a new sage-send-region, and
About expand and combine
Let me enumerate some transforms used in mathematic calculus.
I describe what I understand and insert questions with ???.
I only details theses methods because they are very similar.
4 are called expand and 4 are called combine.
Both are used in mathematics.
e^(2x)
Hello,
Is it possible to compose/iterate functions in sage by a functional way
without any loop for or while.
When I used mupad I could get the u(100) term of this sequence by :
(sin@@100) (1) # u(0)=1 and u(n+1)=sin (u(n))
What does sage propose ? (without any loop)
An other question :
kcrisman wrote :
On Sep 16, 4:04 pm, Francois Maltey fmal...@nerim.fr wrote:
I play with sage, exp, sin, cos, sinh, and co...
var(a,b,c)
exp(a)^2 # returns exp(2a) is right
exp(a)^(1/2) # returns exp (a/2) is wrong, with a=2*i*pi we get -1=1
exp(a)^b # returns exp(a*b) is wrong
Hi,
I play with sage, exp, sin, cos, sinh, and co...
var(a,b,c)
exp(a)^2 # returns exp(2a) is right
exp(a)^(1/2) # returns exp (a/2) is wrong, with a=2*i*pi we get -1=1
exp(a)^b # returns exp(a*b) is wrong
But silly examples about power and asin (sin (x)) seems right.
I find that sage (but
I continue to try to plot in the complex plane the 4 solutions of the
equation :
z^4+2*a*z^2+1 = 0 when a is a real.
I want to get a circle and 2 lines...
Guru ckrisman explains that today this plot seems impossible and gives
me a tip with lambda : calls in plot.
I can make more
58 matches
Mail list logo