Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

simple numerical solve

Hello, I'm trying to solve a fairly simple 1 variable equation, but the output I get is:

[g_a == -31375155/31496372sqrt(-4/5g_a + 1) + 31375155/31496372sqrt(4/5g_a + 8) - 35/8]

Is there a simple way to get a closed-form solution? Hopefully without installing a numerical optimization routine? I have not been able to get simplify to work for this.

Thank you!!

simple numerical solve

Hello, Hello,

Thanks for the help, I'm trying to move from Mathematica to Sage, but I'm still having some trouble with the basics. Specifically, I'm moving from 1-var to 2-var numerical optimization/solver. I want to optimize function g or, equivalently, solve a fairly simple 1 variable equation, but the output the system of first-order conditions, f. So far, I have not been able to get is:

[g_a == -31375155/31496372sqrt(-4/5g_a + 1) + 31375155/31496372sqrt(4/5g_a + 8) - 35/8]

any of the scipy routines to work. Is there a simple way to get a closed-form solution? Hopefully without installing a numerical optimization routine? I have not been able to get simplify to work for this.

Thank you!!do this?

Thanks! jv

Constants

y_a = 50 y_b = 50 x = 40 alpha_a = .2 alpha_b = .2

Functions

v(n)= n^.5 v1(n) = derivative(v(n),n) u(n)= n^.5 u1(n) = derivative(u(n),n)

Variables

var('g_a') var('x_a')

Optimization

g = (v(g_a+alpha_b(x-g_a))-u(y_a)+u(y_a-x_a))(v(x-g_a+alpha_a*(g_a))-u(y_b)+u(y_b-(x-x_a)))

f1 = ((1-alpha_b)v1(g_a+alpha_b(x - g_a)))/((1-alpha_a)v1(x-g_a+alpha_a(g_a)))==(v(g_a+alpha_b(x-g_a))-u(y_a)+u(y_a-x_a))/(v(x-g_a+alpha_a(g_a))-u(y_b)+u(y_b-(x-x_a)))

f2 = (u1(x_a)/u1(x-x_a)) == (v(g_a+alpha_b(x-g_a))-u(y_a)+u(y_a-x_a))/(v(x-g_a+alpha_a(g_a))-u(y_b)+u(y_b-(x-x_a)))

f(g_a, x_a) = (f1, f2)

simple numerical solve

Hello,

Thanks for the help, I'm trying to move from Mathematica to Sage, but I'm still having some trouble with the basics. Specifically, I'm moving from 1-var to 2-var numerical optimization/solver. I want to optimize function g or, equivalently, solve the system of first-order conditions, f. So far, I have not been able to get any of the scipy routines to work. Is there a simple way to do this?this? (Note: the objective function is concave wrt to both arguments.)

Thanks! jv

Constants

y_a = 50 y_b = 50 x = 40 alpha_a = .2 alpha_b = .2

Functions

v(n)= n^.5 v1(n) = derivative(v(n),n) u(n)= n^.5 u1(n) = derivative(u(n),n)

Variables

var('g_a') var('x_a')

OptimizationOptimization (over [0, x])

g = (v(g_a+alpha_b(x-g_a))-u(y_a)+u(y_a-x_a))(v(x-g_a+alpha_a*(g_a))-u(y_b)+u(y_b-(x-x_a)))

f1 = ((1-alpha_b)v1(g_a+alpha_b(x - g_a)))/((1-alpha_a)v1(x-g_a+alpha_a(g_a)))==(v(g_a+alpha_b(x-g_a))-u(y_a)+u(y_a-x_a))/(v(x-g_a+alpha_a(g_a))-u(y_b)+u(y_b-(x-x_a)))

f2 = (u1(x_a)/u1(x-x_a)) == (v(g_a+alpha_b(x-g_a))-u(y_a)+u(y_a-x_a))/(v(x-g_a+alpha_a(g_a))-u(y_b)+u(y_b-(x-x_a)))

f(g_a, x_a) = (f1, f2)

simple numerical solvesolve (2-variables!!)

Hello,

Thanks for the help, I'm trying to move from Mathematica to Sage, but I'm still having some trouble with the basics. Specifically, I'm moving from 1-var to 2-var numerical optimization/solver. I want to optimize function g or, equivalently, solve the system of first-order conditions, f. So far, I have not been able to get any of the scipy routines to work. Is there a simple way to do this? (Note: the objective function is concave wrt to both arguments.)

Thanks! jv

Constants

y_a = 50 y_b = 50 x = 40 alpha_a = .2 alpha_b = .2

Functions

v(n)= n^.5 v1(n) = derivative(v(n),n) u(n)= n^.5 u1(n) = derivative(u(n),n)

Variables

var('g_a') var('x_a')

Optimization (over [0, x])

g = (v(g_a+alpha_b(x-g_a))-u(y_a)+u(y_a-x_a))(v(x-g_a+alpha_a*(g_a))-u(y_b)+u(y_b-(x-x_a)))

f1 = ((1-alpha_b)v1(g_a+alpha_b(x - g_a)))/((1-alpha_a)v1(x-g_a+alpha_a(g_a)))==(v(g_a+alpha_b(x-g_a))-u(y_a)+u(y_a-x_a))/(v(x-g_a+alpha_a(g_a))-u(y_b)+u(y_b-(x-x_a)))

f2 = (u1(x_a)/u1(x-x_a)) == (v(g_a+alpha_b(x-g_a))-u(y_a)+u(y_a-x_a))/(v(x-g_a+alpha_a(g_a))-u(y_b)+u(y_b-(x-x_a)))

f(g_a, x_a) = (f1, f2)