Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm not sure if the title fits.

I'm basically just looking for a way to define a value and constrain it to $[a,b]$ when I use Solve later.

More specifically, I have a set of three equations where both sides are normalized to be in $[0, 1]$.

The right hand side is just a Ratio $\dfrac{b_i}{\sum{b_i}}$.

The left hand side is similar because it is also normalized to be in $[0, 1]$. I have an index which is based on a multiplicative function where I have a product of some variables which are all to the power of some exponent and then divided by the sum of the indices, therefore $[0, 1]$. Since Solve is not able to solve this and for context reasons, I would like to restrict the exponents to values from $[-1, 1]$. Can I do this?

n = 3;
ebau[1] = Ebau - Sum[ebau[i], {i, 2, n}];
a[1] = A - Sum[a[i], {i, 2, n}];
b[1] = B - Sum[b[i], {i, 2, n}];
Fair = Table[a[i]^(\[Alpha])*ebau[i]^(-\[Beta])*b[i]^(\[Gamma]), {i, 1, n}];
Weight = Simplify[Fair/Sum[Fair[[i]], {i, n}]];
phiSO = {b[1]/B, b[2]/B, b[3]/B};
Solve[Table[ phiSO[[i]] == Weight[[i]], {i, 1, n}], 
      {\[Alpha], \[Beta], \[Gamma]}, Reals]
share|improve this question
What, precisely, are these equations? Solve[] and Reduce[] do support constraining the variables (via inequalities), but unless you give a more concrete example, we can't be very helpful... – 0x4A4D Aug 24 '12 at 10:28
I still dont get how to properbly include mathematica code, someone told me it was CRTL+K, but that does not seem to work, so heres my problem: n = 3; ebau[1] = Ebau - Sum[ebau[i], {i, 2, n}]; a[1] = A - Sum[a[i], {i, 2, n}]; b[1] = B - Sum[b[i], {i, 2, n}]; Fair = Table[ a[i]^([Alpha])*ebau[i]^(-[Beta])*b[i]^([Gamma]), {i, 1, n}]; Weight = Simplify[Fair/Sum[Fair[[i]], {i, n}]]; phiSO = {b[1]/B, b[2]/B, b[3]/B}; Solve[Table[ phiSO[[i]] == Weight[[i]], {i, 1, n}], {[Alpha], [Beta], [Gamma]}, Reals] – Max M Aug 24 '12 at 10:37
ctrl-k is not used to paste code, but to format as a code block code you already pasted. So the flow is: paste MMA code (preferably as InputForm or so), select block, hit ctrl-k (or the code block icon above the edit field). – Sjoerd C. de Vries Aug 24 '12 at 11:24
You can replace the first argument of Solve in your code with Join[Table[phiSO[[i]] == Weight[[i]], {i, 1, n}], (-1 <= # <= 1) & /@ {\[Alpha], \[Beta], \[Gamma]}] to include the constraints on \[Alpha], \[Beta], \[Gamma]. – kguler Aug 24 '12 at 11:25
2  
I am not sure what watch out means. But if you write D=1 then you'll get an error. And if you write Z=1 and in Mathematica version 11 they add Z to the list of protected symbols (WRI can do that, since they told you not to use UpperrCase), then your program will not work any more. – Nasser Aug 24 '12 at 13:06
show 6 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.