Ask Your Question

CyrilleP's profile - activity

2023-05-19 22:06:29 +0100 received badge  Popular Question (source)
2021-12-15 11:29:05 +0100 asked a question How to recover indices ?

How to recover indices ? Suppose I have indexed variables as z=[var(f'p_{k}{l}') for k in range(2) for l in range(4)]

2021-12-14 17:07:23 +0100 asked a question Iterate on a LatexExpr

Iterate on a LatexExpr This is certainly a question I have already asked, but I don't find any source. I have a list of

2021-12-14 16:14:24 +0100 marked best answer Index without multiplicities

I want really the vector zz. Unfortunatelly as 5 is present with multiplicity 2 the only index for 5 is 0. I want also 2. How to obtain the desired return ?

So

z=[5,0,5,0,10,13,14,] 
zz=[(z.index(v),v) for v in z if v!=0]
show(zz)

returns [(0, 5), (0, 5), (4, 10), (5, 13), (6, 14)] when I want [(0, 5), (2, 5), (4, 10), (5, 13), (6, 14)].

2021-12-14 12:39:03 +0100 commented answer Unable to calculate market equilibrium

So I must apologize but unfortunately I have not always the good way to search.

2021-12-14 12:03:31 +0100 edited question Index without multiplicities

Index without multiplicities I want really the vector zz. Unfortunatelly as 5 is present with multiplicity 2 the only in

2021-12-14 12:02:03 +0100 asked a question Index without multiplicities

Index without multiplicities I want really the vector zz. Unfortunatelly as 5 is present with multiplicity 2 the only in

2021-12-12 10:18:11 +0100 commented answer A linear program returns infeasible but I think to know a feasible solution.

David thanks for your answer. Unfortunatelly I cannot bypass the lower bound. In one way, this is not a true problem. Ma

2021-12-12 10:17:51 +0100 commented answer A linear program returns infeasible but I think to know a feasible solution.

David thanks for your answer. Unfortunatelly I cannot bypass the lower bound. In one way, this is not a true problem. Ma

2021-12-12 09:51:38 +0100 commented answer A linear program returns infeasible but I think to know a feasible solution.

David thanks for your answer. Unfortunatelly I cannot bypass the lower bound. In one way, this is not a true problem. Ma

2021-12-10 22:31:44 +0100 commented answer Unable to calculate market equilibrium

Emmanual, I have now stayed a very long time on Sage but docs are not always up to date and when you do not know what t

2021-12-10 16:06:37 +0100 edited question A linear program returns infeasible but I think to know a feasible solution.

A linear program returns infeasible but I think to know a feasible solution. I have the following linear programming pro

2021-12-10 11:52:48 +0100 edited question A linear program returns infeasible but I think to know a feasible solution.

A linear program return infeasible but I think to know a feasible solution. I have the following linear programming prog

2021-12-10 09:55:58 +0100 marked best answer Solve return an implicit equation

The following solve() resists to any argument (to_poly_solve... calling giac sympy or anything else) in the way that it return an implicit solution in y

var('y')
A=n((1/2)*((1/4)*log(35000*0.25+100)+(3/4)*log(100)))
B=n((1/2)*((1/2)*log(35000*0.25+100)+(1/2)*log(100)))
C=(1/2)*A+ (1/2)*B
D=(1/2)*((1/2)*log(35000*0.25+100-y)+(1/2)*log(100-y))

sol=solve(D-C==0,y)[0]
sol

Of course I can find the solution acting the following way, but I find it after a long search and it seems inelegant.

sol1=e^sol.rhs()-e^sol.lhs()
sol21=n(solve(sol1==0,y)[0].rhs())
sol22=n(solve(sol1==0,y)[1].rhs())
show(sol21)
show(sol22)

Is there an other way ?

2021-12-10 09:52:22 +0100 asked a question A linear program returns infeasible but I think to know a feasible solution.

A linear program return infeasible but I think to know a feasible solution. I have the following linear programming prog

2021-12-06 18:14:45 +0100 edited question Solve return an implicit equation

Solve return an implicit equation The following solve() resists to any argument (to_poly_solve... calling giac sympy or

2021-12-06 18:13:58 +0100 asked a question Solve return an implicit equation

Solve return an implicit equation The following solve() resists to any argument (to_poly_solve... calling giac sympy or

2021-12-05 22:28:21 +0100 marked best answer Linearization of the objective in "MixedIntegerLinearProgram"

I have a Mixed integer program with non lineazr objective. But as it is the product of power there is no difficulty to linearize. But the program refuses the following modelization.

    po=[0.6,0.5,0.55,0.45,0.62,0.54,0.58,0.5]
    c=vector([ln(u) for u in po])
    nc=3 #nombre de contraintes
    nv=8 #nombre de variables
    A=matrix(nc,nv,[1,1,1,1,0,0,0,0,
                              0,0,0,0,1,1,1,1,
                              500,550,600,700,420,460,500,580])
    B0=[40,30,45000] #borne inférieure
    B1=[0,0,0] #borne supérieure
    P=MixedIntegerLinearProgram(maximization=True, solver="GLPK")
    x=P.new_variable(integer=True, nonnegative=False, indices=[0..nv-1])
    B

=A*x
zz=c*x
P.set_objective(zz)
for i in range(0,nc):
     P.add_constraint(B[i],min=B0[i], max=B1[i])
for i in range(0,nv):
     P.set_min(x[i],0)
#xi doit avoir pour minimum 0
P.show()

obviously its P.set_objective(zz) which doesn't work.

2021-12-05 18:05:11 +0100 asked a question Linearization of the objective in "MixedIntegerLinearProgram"

Linearization of the objective in "MixedIntegerLinearProgram" I have a Mixed integer program with non lineazr objective.

2021-11-20 19:37:41 +0100 commented answer Iteration inside a LatexExpr

What means the f in front of the r and why the \text need double {{

2021-11-20 19:36:16 +0100 marked best answer Iteration inside a LatexExpr

For presentation reason I have a show like the following one :

show(LatexExpr(r"\text{The variable } x[i] \text{ takes the value :}"), x[i])

How could I have an iteration on on I to display in the text say $x_1$, ...,$x_{10}$ in place of the x[i].

2021-11-20 18:51:50 +0100 asked a question Iteration inside a LatexExpr

Iteration inside a LatexExpr For presentation reason I have a show like the following one : show(LatexExpr(r"\text{The

2021-10-30 18:20:10 +0100 marked best answer Select element of a list through the value of an operator

Here follow an occurence of a Fourier-Motzkin elimination.

fmf=[z<=4*x_1+ 3*x_2, x_1 + 3*x_2 <= 2100, 4*x_1+ 2*x_2<=1900, x_1<=200,x_2>=300, x_1 >=0,x_2 >=0]
fmf
fm_sol=solve_ineq(fmf,[x_1, x_2,z])
fm_sol

How can I select only the elements of the list generated by fm_sol where the operator for z is == ?

2021-10-30 18:20:08 +0100 commented answer Select element of a list through the value of an operator

Thanks ! Exactly what I was unable to code.

2021-10-30 17:56:20 +0100 received badge  Student (source)
2021-10-30 17:40:24 +0100 edited question Select element of a list through the value of an operator

Select element of a list through the value of an operator Here follow an occurence of a Fourier-Motzkin elimination. fm

2021-10-30 17:39:51 +0100 received badge  Editor (source)
2021-10-30 17:39:51 +0100 edited question Select element of a list through the value of an operator

Select elioment of a list through the value of an operator Here follow an occurence of a Fourier-Motzkin elimination. f

2021-10-30 17:37:22 +0100 asked a question Select element of a list through the value of an operator

Select elioment of a list through the value of an operator Here follow an occurence of a Fourier-Motzkin elimination. f

2021-10-29 21:33:08 +0100 commented answer 'Graphics' object is not callable

Thanks. I feel so stupid.

2021-10-29 21:32:46 +0100 marked best answer 'Graphics' object is not callable

Sorry to ask anonymously a question but I cannot recover my account (...@...). . Why

var("x_2 z")
sol1=solve(4*x_1+ 3*x_2==z,x_2)
show(sol1)
obj1=sol1[0].substitute(z=10).rhs()
show(obj1)
plot(obj1,(x_1,0,100))

leads to 'Graphics' object is not callable ?

2021-10-29 21:32:46 +0100 received badge  Scholar (source)
2021-10-29 10:56:52 +0100 asked a question 'Graphics' object is not callable

'Graphics' object is not callable Sorry to ask anonymously a question but I cannot recover my account (cyrille.piatecki@