math,point,sage,elliptic-curve

Since you did not include code to reproduce your situation, I take an example curve from the Sage documentation: sage: E = EllipticCurve(GF(101),[23,34]) Generating random points You can repeatedly use random_element or random_point to choose points at random: sage: E.random_point() (99 : 92 : 1) sage: E.random_point() (27 : 80...

According to the documentation for polar_plot, the function plotted "polarly" is the radius, with whatever variable you put in as the variable for the angle (in radians). Indeed, polar_plot(pi/4, 0, 2*pi, rgbcolor=hue(0.6)) would be sufficient for your first plot. As far as actually plotting what you really want, I don't...

Hmm, that is a really good question. To the best of my knowledge, the answer is no. In any case, it would be arbitrarily computationally expensive to always check whether things up are equal up to a constant... That said, that is annoying for your case - and also for...

This is essentially directly using Maxima, so (%i11) display2d: false; (%o11) false (%i12) f:r^2*acos((r-h)/r)-(r-h)*sqrt(2*r*h-h^2); (%o12) r^2*acos((r-h)/r)-(r-h)*sqrt(2*h*r-h^2) (%i13) taylor(f,h,0,3); (%o13) 4*sqrt(r)*sqrt(2)*h^(3/2)/3-sqrt(r)*sqrt(2)*h^(5/2)/(5*r) Expanding around other points gives what we expect, so I guess this is some kind of bug (or undocumented feature) in Maxima. (%i22) taylor(sqrt(x),x,0,5); (%o22) +sqrt(x) (%i23) powerseries(sqrt(x),x,0); (%o23) sqrt(x)...

python,loops,plot,ipython,sage

import numpy as np import matplotlib.pyplot as plt import time @interact def _(f=(1,10,1)): plt.cla() n = 100 T = 1 dt = T/n x = np.arange(1, step=dt) W = np.zeros(n, np.dtype(float)) t = np.arange(2.8,3.0,0.1) l = np.sqrt(2*t*ln(ln(t))) plt.plot(l) # <= add subplot # Z variable, N(0,1) mu, sig = 0,...

I'm not completely sure of what you want to achieve. PHP's exec function executes a shell command, and that's all. Read http://fr2.php.net/manual/en/function.exec.php. sage: f = 5*x^3 is not a shell command. You can run sage scripts directly via the command line using the -c switch : ./sage -c 'print latex((5*x^3).diff())' will...

python,matrix,virtual-machine,sage

Sage can only use its own Python, if that makes sense. On Windows there are a lot of problems with certain components of Sage compiling properly (non-Python components, of course) which is why there is not a 'native port', though Cygwin should work okay if that is an option for...

You do sage: _.<X> = GF(2)[] sage: K.<x> = GF(2^8, modulus=X^8+X^4+X^3+X+1) sage: (x^8 + 1)^-1 x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + 1 ...

Sage functions work with Sage structures (variables, matrices, functions, etc), which are not JavaScript objects. JavaScript does not have a thing to which you could apply Sage commands like plot or indefinite_integral. The mobile Sage apps work by sending user input to be parsed to Sage Cell Server, and displaying...

You need to use ast.literal_eval to parse the strings into lists: from ast import literal_eval with open('log.csv', 'rt') as logFile: logreader = csv.reader(logFile) for row in logreader: a = literal_eval(row[3]) b = literal_eval(row[4]) See a demonstration below: >>> from ast import literal_eval >>> literal_eval("[[(0, 0, 1), (1, 0, 0)]]") [[(0,...

python,wolfram-mathematica,sage

According to Trac 16703, this problem should be fixed in the latest Sage. I don't personally have a copy of Mathematica to test this on.

It's normal to see a message like that once upon first connecting to a server. If it asks if it's ok to continue connecting, just say "yes". That public key will then be added to your local ~/.ssh/known_hosts file (associated with that IP address or domain). There's only a problem...

The problem isn't the '<' operator but the usage of 'for'. It looks like in sage, the 'for' loop specifically iterates over fixed lists. Replace your 'for' with 'while' and you'll get the behavior you want. A second problem is that instead of the Fibonacci sequence, 'list1' ends up containing...

I suggest changing your file name to file.sage and then just do sage file.sage The preparser very intentionally is only used with .sage files or in the notebook/command line, so that one can also separately do Python stuff as you like....

The problem is the browser using the built in scroll function which I accidentally overrode. I changed the name of my function and all works correctly:)...

The usual way to do this is to make an equation out of them and check whether it is True or False. sage: e4 == e5 x*(y + 1) == x*y + x sage: bool(_) True However, keep in mind that Sage will return False if it cannot prove it...

Probably this is due to a Python build (Sage's Python, that is) that didn't successfully build this module; see this sage-release thread. In principle http://trac.sagemath.org/ticket/17174 should have fixed it (see http://trac.sagemath.org/ticket/17169) but perhaps you are using a non-Sage gcc, such as homebrew? In that event you'll need to either make...

You might find differential forms more useful here. You'll note that you just have dx as a variable, which is ahead of both x and y in alphabetical order.

python,enumeration,sage,galois-field

You could simply use nested loops over the elements of k, instead of over the indices of the elements: sage: for e0 in k: ....: for e1 in k: ....: print '(%s) + (%s) = %s' % (e0, e1, e0+e1) ....: (0) + (0) = 0 (0) + (x) =...

The problem here is that you have not created a function at all. You have created a Python variable, which refers to U/I, which is a "symbolic expression", and as such (for better or worse) is just itself. See e.g. this SO question which I think is relevant. This is...

You forgot parentheses. Instead of sage: B.<a,b,c> = BooleanPolynomialRing either write, using the condensed syntax, sage: B.<a,b,c> = BooleanPolynomialRing() or use the more explicit syntax sage: B = BooleanPolynomialRing(3,['a','b','c']) sage: a, b, c = B.gens() in which the first line sets the display names of the polynomial variables as a,...

I can create something sort of like yours, though with no errors. At least it doesn't do what you want. def f(m,n): return m*randint(100,200)-n*randint(100,200) var('x,y') plot_vector_field((f(x,y),f(y,x)),(x,0,1),(y,0,1)) The reason is because Python functions immediately evaluate - in this case, f(x,y) was 161*x - 114*y, though that will change with each invocation....

There's a typo in your code. You want i=1 instead of i==1.

Take a look at simplify_sum which applies several kinds of identities, including Gosper's and Zeilberger's methods. (%i1) load (simplify_sum); (%o1) /usr/share/maxima/5.35.1/share/solve_rec/simplify_sum.mac (%i2) 'sum(k * x^k, k, 0, inf); inf ==== \ k (%o2) > k x / ==== k = 0 (%i3) simplify_sum (%); x (%o3) ------------ 2 x -...

In Sage, the input is preparsed by the Sage preparser. I'll use 12 instead of 128 so the examples fit in one line. When you input the following: sage: import numpy sage: perm = numpy.random.permutation(12) The error message you get looks like: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-3-38b6a5e3e889>...

Indent the k=... line. Also, please consider using self-explanatory variable names for clearer code. def elgamal_encrypt ( pub_key ,g ,p , message ): k = floor ( 1+( p -2)* random ()) return ( Mod (g , p )^ k , message * Mod ( pub_key ^k , p )...

Starting from Sage 6.5, to transform a into b, use the method canonicalize_radical. sage: a.canonicalize_radical() x^(2*y) Note that the four methods simplify_exp, exp_simplify, simplify_radical, radical_simplify, which had the same effect, are being deprecated in favour of canonicalize_radical. See Sage trac ticket #11912. I don't know if there is a...

Yes. sage: var('x y z') (x, y, z) sage: expr = x^2*y + 2*z sage: expr.variables() (x, y, z) ...

I don't think you can import things directly, but only from sage.all, when not in the Sage shell. Sage imports a lot of stuff. Try this. $ sage -ipython Python 2.7.5 (default, Oct 7 2013, 07:44:02) Type "copyright", "credits" or "license" for more information. IPython 0.13.2 -- An enhanced Interactive...

There are a few options in Sage with solve, and this one seems to help (I assume the answer is okay). sage: solve(sqrt(x)==sqrt(20*(1500-x)),x,to_poly_solve=True) [x == (10000/7)] ...

Since the 1st dim of a and b is 2, it is calculating cp = a[0]*b[1] - a[1]*b[0] For an ordinary numpy array, this works fine: np.cross([1,2],[2,1]) # -3 because np.array([1,2])[0].ndim # 0 I don't have Sage, but your error message says that the elements of the arrays are sage.symbolic.expression.Expression...

Not irrelevant at all, but you didn't read the instructions for Windows. Currently there is only a virtualization option - one which is pretty popular, from what I can tell. Here is one mirror that might be near you, and note it says Please read the Sage Virtual Machine manual....

Your desired output isn't quite well defined, because the monomials you listed are not in the lexicographic order (which you used in the first line of your code). Anyway, using a double loop you can arrange coefficients in any specific way you want. Here is a natural way to do...

python,python-2.7,math,sage,elliptic-curve

I did a fresh install of Arch Linux and that fixed the problem. I'm guessing it probably had something to do with my python2/3 configuration.

If you want a histogram, bar_chart is a wrong tool for the job. Use plot_histogram instead. It applies to a Time Series object, so the data has to be converted to it first. Examples (with a richer data set, so multiple items sometimes fall into one bin): my_data = [0,1,2,5,3,2,3,8,2,10]...