0
$\begingroup$

for example, y=a x^2+ a(b x^2)+c^3 x^2+z^2+c z how to tansfer function y to formart like y=?x^2+ ?x+? and y=?z^2+?z+? So, I want to tansfer the equation below to arrange both A_{2l} and A_{2h} (one answer is ascending the order of A_{2l} while another answer is ascending order A_{2h})in ascending order. Thank you so much. enter image description here

(-4 (Subscript[c, n] + Subscript[c, nature] - Subscript[\[Delta], 
m]) + k (-2 Subscript[A, 2 l] (-1 + Subscript[c, l]) + 
Subscript[A, 
2 h] (2 - 
Subscript[c, 
h] (2 + (2 + k Subscript[A, 2 l]) Subscript[\[Lambda], h]) + 
Subscript[\[Lambda], 
h] (-2 + 4 Subscript[c, n] + 4 Subscript[c, nature] + 
2 k Subscript[A, 2 h] (-1 + Subscript[\[Lambda], h]) + 
2 Subscript[\[Delta], m] (-1 + Subscript[\[Lambda], h]) + 
k Subscript[A, 
2 l] (-2 + Subscript[c, 
l] + (1 - Subscript[c, l] + Subscript[c, n] + Subscript[
c, nature]) Subscript[\[Lambda], h]))) + 
Subscript[A, 
2 l] (-2 (1 + k Subscript[A, 2 l] + Subscript[c, l] - 
2 Subscript[c, n] - 2 Subscript[c, nature] + 
Subscript[\[Delta], m]) + 
k Subscript[A, 
2 h] (-2 + Subscript[c, h] - Subscript[c, 
l] + (Subscript[c, h] + Subscript[c, l] - 
2 (-1 + Subscript[c, n] + Subscript[c, 
nature])) Subscript[\[Lambda], 
h])) Subscript[\[Lambda], l] + 
Subscript[A, 
2 l] (k Subscript[A, 
2 h] (1 - Subscript[c, h] + Subscript[c, n] + Subscript[c, 
nature]) + 
2 (k Subscript[A, 2 l] + Subscript[\[Delta], m])) 
\!\(\*SubsuperscriptBox[\(\[Lambda]\), \(l\), \(2\)]\) - 
2 Subscript[A, 
2] (2 + k Subscript[A, 
2 h] (-1 + Subscript[\[Lambda], h]) Subscript[\[Lambda], h] +
k Subscript[A, 
2 l] (-1 + Subscript[\[Lambda], l]) Subscript[\[Lambda], 
l])))
$\endgroup$
  • $\begingroup$ If you are typing these by hand, you can use HoldForm. For example HoldForm[y^2 + x^2]. If it is an output from a computation you will likely have to select the elements, convert them to strings, join them together etc..any reason why you want it to be so ? $\endgroup$ – Lotus May 26 '17 at 13:10
  • $\begingroup$ because I want to analysis the relationship between y and A_{2l} , also the relationship between y and A_{2h} $\endgroup$ – Centrino Gu May 26 '17 at 13:26
2
$\begingroup$

Use indexed variables. Subscripts cannot be variables.

Format[c[n_]] := Subscript[c, n];
Format[δ[n_]] := Subscript[δ, n];
Format[A[n_]] := Subscript[A, n];
Format[λ[n_]] := Subscript[λ, n];

expr = -4 (c[n] + c[nature] - δ[m]) + 
   k (-2 A[2 l] (-1 + c[l]) + 
      A[2 h] (2 - 
         c[h] (2 + (2 + k A[2 l]) λ[h]) + λ[
           h] (-2 + 4 c[n] + 4 c[nature] + 
            2 k A[2 h] (-1 + λ[h]) + 
            2 δ[m] (-1 + λ[h]) + 
            k A[2 l] (-2 + 
               c[l] + (1 - c[l] + c[n] + c[nature]) λ[h]))) + 
      A[2 l] (-2 (1 + k A[2 l] + c[l] - 2 c[n] - 
            2 c[nature] + δ[m]) + 
         k A[2 h] (-2 + c[h] - 
            c[l] + (c[h] + c[l] - 
               2 (-1 + c[n] + c[nature])) λ[h])) λ[
        l] + A[2 l] (k A[2 h] (1 - c[h] + c[n] + c[nature]) + 
         2 (k A[2 l] + δ[m])) λ[l]^2 - 
      2 A[2] (2 + k A[2 h] (-1 + λ[h]) λ[h] + 
         k A[2 l] (-1 + λ[l]) λ[l]));

Then use Collect

(expr21 = Collect[expr, A[2 l]])

enter image description here

(expr22 = Collect[expr, A[2 h]])

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.