Ask Your Question

Arnaud1418's profile - activity

2022-11-24 00:48:23 +0100 received badge  Notable Question (source)
2021-07-31 20:54:28 +0100 received badge  Famous Question (source)
2021-03-12 13:17:34 +0100 received badge  Notable Question (source)
2020-02-28 23:33:15 +0100 received badge  Popular Question (source)
2018-10-10 23:11:55 +0100 received badge  Popular Question (source)
2018-08-13 17:26:00 +0100 received badge  Nice Question (source)
2016-10-03 15:38:21 +0100 received badge  Notable Question (source)
2016-06-03 13:42:29 +0100 received badge  Nice Question (source)
2016-06-02 20:11:36 +0100 asked a question Coercion and Laurent polynomial

Hi! Is there a simple way to make easy coercion from Symbolic Ring to Laurent polynomial ring (or even algebraic extension)? I've only been able to bypass the problem by the following trick (and due the amount of time I've spent on this I'm happy to share it!) :

# Polynomial in the Symbolic Ring
var('t')
P = t^3 + 1/10*t + 3*t^-1

# Laurent polynomial     
ringS.<t> = LaurentPolynomialRing(QQ)  

#PP = ringS(P)  # Not working
PP = ringS(sage_eval(str(P),locals={'t':t}))

print P, P.parent()
print PP, PP.parent()
2016-01-28 17:28:48 +0100 received badge  Supporter (source)
2016-01-28 14:04:24 +0100 received badge  Popular Question (source)
2016-01-27 20:12:43 +0100 asked a question Integer result for fraction

Hi!

Can somebody explain me this strange behavior of Sage :

for p in range(1,10):
    for q in range(1,10):
        print p/q

Then p/q return the integer division.

However:

for p in range(1,10):
    print p/7

give rational results.

A solution is to use Rational(p)/Rational(q) instead of p/q. But it is not an explanation.

Thanks,

Arnaud

2015-04-02 08:25:52 +0100 received badge  Popular Question (source)
2015-03-30 20:15:49 +0100 answered a question Handle variable name

Compiling the answers above, here is a simple mean value function taking as parameters (i) a function and (ii) a triple defining the variable and the min and max values.

def meanvalue(f,mytriple):
    myvar,mymin,mymax = mytriple
    return f.subs(myvar==(mymin+mymax)/2)

var('z')
f = z^2
meanvalue(f,(z,0,1))

Thanks to everyone for answers!

2015-03-30 15:43:22 +0100 received badge  Editor (source)
2015-03-30 15:41:21 +0100 asked a question Handle variable name

Dear all,

I would like to pass a function as a parameter and also one of its variable. The simplest situation would just to evaluate a function f.

def test(f,myvar,myval):
    return f(myvar=myval)

f = x^2
print(test(f,x,3)

It returns x^2, but I would like 9. Of course I don't know a priori what would be the name of the variable and f may have several variables.

The long question is that I would like to define something that plot(f,(x,xmin,xmax)). Is there's a standard way to handle this triple (x,xmin,xmax)? Is there's a web page for the source code for such functions to study the standard implementation?

Thanks a lot! Arnaud

2015-03-27 16:04:23 +0100 received badge  Student (source)
2015-03-27 15:31:57 +0100 asked a question Get objects from a Graphics3dGroup

Dear all,

I would like to trasnform a 3d object into a set of faces (or triangles). For that, I take a 3d object and convert it to a STL file following this procedure.

The short questions is: how to get the 3d objects from a Graphics3dGroup?

The long question : I don't understand the nature of the 3d graphics. For instance:

G1 = polygon3d([(0,0,0),(1,0,0),(2,1,1)])
print(type(G1))
G2 = polygon3d([(0,0,0),(1,0,0),(2,1,1)]) + polygon3d([(1,2,3),(1,0,0),(2,1,1)])
print(type(G2))
G3 = sphere((0,0,0),1)
print(type(G3))
  1. In the first case it seems to be a set of faces and it's possible to convert it to a STL file.
  2. In the second case it is a group of 3d object and -as a group- it has no face.
  3. The sphere is a TransformGroup and has no face.

How to get the faces of the last two situations?

Thanks for yours answers.

Arnaud

2015-03-19 13:14:34 +0100 received badge  Scholar (source)
2015-03-19 13:14:30 +0100 commented answer Update to Sage 6.5 on Ubuntu 14.10

Thanks for your answer! I will wait for the new version...

2015-03-19 08:50:12 +0100 asked a question Update to Sage 6.5 on Ubuntu 14.10

Hi,

My current version is Sage 6.4 on Ubuntu 14.10. The problem is that Sage is not updated by the update system of ubuntu and I didn't succeed in updating sage to the latest version by hand.

After executing the instructions there https://launchpad.net/~aims/+archive/...

sudo -E apt-add-repository -y ppa:aims/sagemath
sudo -E apt-get update
sudo -E apt-get install sagemath-upstream-binary

The system answer that "sagemath-upstream-binary is already the latest version".

Thanks for your solutions! Arnaud