ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 16 Nov 2016 05:12:07 -0600Particular solve: find values of variables which will solve equation for any values of other variableshttp://ask.sagemath.org/question/35609/particular-solve-find-values-of-variables-which-will-solve-equation-for-any-values-of-other-variables/ Hi, this is my first time using Sage, so I hope my questions aren't too trivial.
I have to solve the following problem: find (if they exist) values of real variables x,u,v (with x,v>0) such that the following equality
Maximum{2 a/x, 2 (u*b + v*c)/(u^2 + v^2),
2 ((u - x)*(b - a) + v*c)/(v^2 + (u - x)^2)} = (a/x + c/v) + (1/v*x)*sqrt(
a^2 (u^2 + v^2) - 2 a*x*(b*u + c*v) + (b^2 + c^2)*x^2)
is verified for every value of the real values a, b, c.
It is my understanding that to evaluate the maximum I should use max_symbolic, am I right?
Let me emphasize that I don't need to find values of x,u,v with respect to a,b,c, but fixed values of x,u,v which will verify the equality for any given a,b,c. This means that I need to find x, u, v which will verify all the infinite equations we will get for any different triple of values of a, b, c.
For this reason writing
x,u,v,a,b,c=var('x u v a b c')
s1=solve([max_symbolic(2 a/x, 2*(u*b + v*c)/(u^2 + v^2), 2 ((u - x)*(b - a) + v*c)/(v^2 + (u - x)^2)) == (a/x + c/v) +(1/v*x)*sqrt(a^2 (u^2 + v^2) - 2 a*x*(b*u + c*v) + (b^2 + c^2)*x^2)],x,u,v)
show(s1)
will not work. I've thought of solving for all 6 variables, but then an error occurred saying solve() could only use 5 positional arguments..
Can you suggest me any way to proceed? Also, I fear this kind of computation will be very heavy for my cpu.. Any ideas on how to make It lighter?
Thank you very much!nibWed, 16 Nov 2016 05:12:07 -0600http://ask.sagemath.org/question/35609/max_symbolic and distributive law with multiplicationhttp://ask.sagemath.org/question/26214/max_symbolic-and-distributive-law-with-multiplication/Minimum and maximum are distributive over multiplication of non-negative numbers, i.e., if a,b,c >= 0 then
a * max{ b, c } = max { ab, ac }
and the same works for min{}. How can I exploit this in sagemath? Consider the followiing:
n=5
x=var(['x_'+str(i+1) for i in range(n)])
# (x_1, x_2, x_3, x_4, x_5)
assume([x[i] >= 0 for i in range(n)])
assumptions()
# [x_1 >= 0, x_2 >= 0, x_3 >= 0, x_4 >= 0, x_5 >= 0]
This does **not** work as expected:
y = max_symbolic( x[4] * max_symbolic(x[0],x[1]), x[0] * max_symbolic(x[2],x[3]) )
# y == max(x_5*max(x_1, x_2), x_1*max(x_3, x_4))
simplify(y)
# max(x_1*max(x_3, x_4), x_5*max(x_1, x_2))
Simplify does not do the simplification I want it to do, which should yield
## max(max(x_1*x_3, x_1*x_4), max(x_5*x_1, x_5*x_2))
or even better
## max(x_1*x_3, x_1*x_4, x_5*x_1, x_5*x_2)
Needless to say, I have also tried `expand` and `full_simplify`. None of them does the trick.
So, I wonder, am I missing out on some other fancy function here, or is there a (hopefully easy) way to add a distributive law-feature to the max_symbolic function?BjornTue, 17 Mar 2015 00:12:56 -0500http://ask.sagemath.org/question/26214/Recursive max_symbolic???http://ask.sagemath.org/question/8921/recursive-max_symbolic/Hi
Over a (x,y) space, I have n functions resp f_1(x,y), f_2(x,y), ..., f_n(x,y) and I would like to create g(x,y) =max(f_1(x,y), f_2(x,y), ..., f_n(x,y), constant)
I now know it is possible to use max_symbolic with 2 functions, but then if I have say 100 of them, it gets clumpsy.
Does anyone know a way to do that?
ThankssagembTue, 24 Apr 2012 08:25:47 -0500http://ask.sagemath.org/question/8921/