0
$\begingroup$

The function

AnI[n_]:=(-((2 n ((R1/R2)^((2 \[Pi])/\[Beta]) - (R2/R1)^(( 2 \[Pi])/\[Beta])) \[Beta] Aki[ 2] (Sin[n theta1] - Sin[n (theta1 + \[Beta])]))/( R2 ((R1/R2)^((2 \[Pi])/\[Beta]) + (R2/R1)^(( 2 \[Pi])/\[Beta])) (4 \[Pi]^2 - n^2 \[Beta]^2))) - ( n ((R1/R2)^(\[Pi]/\[Beta]) - (R2/R1)^(\[Pi]/\[Beta])) \[Beta] Aki[ 1] (Sin[n theta1] + Sin[n (theta1 + \[Beta])]))/( R2 ((R1/R2)^(\[Pi]/\[Beta]) + (R2/R1)^(\[Pi]/\[Beta])) (\[Pi] - n \[Beta]) (\[Pi] + n \[Beta]))); 

This expression contains Aki[n], for example Aki[1], Aki[2]...

Another function is

Aki[k_]:=(\[Beta] ((2 R2 (R2/R3 + R3/R2) CnI[1])/((R2/R3 - R3/R2) \[Beta]) + ( 4 R3 DnI[1])/((-(R2/R3) + R3/R2) \[Beta])) (-\[Beta] Cos[ theta1] + \[Beta] Cos[k \[Pi]] Cos[theta1 + \[Beta]] + k \[Pi] Sin[k \[Pi]] Sin[ theta1 + \[Beta]]))/((k \[Pi] - \[Beta]) (k \[Pi] + \[Beta])) + \ (\[Beta] ((2 R2 (R2/R3 + R3/R2) AnI[1])/((R2/R3 - R3/R2) \[Beta]) + ( 4 R3 BnI[1])/((-(R2/R3) + R3/R2) \[Beta])) (k \[Pi] Cos[ theta1 + \[Beta]] Sin[ k \[Pi]] + \[Beta] (Sin[theta1] - Cos[k \[Pi]] Sin[ theta1 + \[Beta]])))/((k \[Pi] - \[Beta]) (k \[Pi] + \ \[Beta])) + (\[Beta] (( R2 (R2^2/R3^2 + R3^2/R2^2) CnI[ 2])/((R2^2/R3^2 - R3^2/R2^2) \[Beta]) + ( 2 R3 DnI[ 2])/((-(R2^2/R3^2) + R3^2/R2^2) \[Beta])) (-2 \[Beta] Cos[ 2 theta1] + 2 \[Beta] Cos[k \[Pi]] Cos[2 (theta1 + \[Beta])] + k \[Pi] Sin[k \[Pi]] Sin[2 (theta1 + \[Beta])]))/( k^2 \[Pi]^2 - 4 \[Beta]^2) + (\[Beta] (( R2 (R2^2/R3^2 + R3^2/R2^2) AnI[ 2])/((R2^2/R3^2 - R3^2/R2^2) \[Beta]) + ( 2 R3 BnI[2])/((-(R2^2/R3^2) + R3^2/R2^2) \[Beta])) (k \[Pi] Cos[ 2 (theta1 + \[Beta])] Sin[k \[Pi]] + 2 \[Beta] (Sin[2 theta1] - Cos[k \[Pi]] Sin[2 (theta1 + \[Beta])])))/( k^2 \[Pi]^2 - 4 \[Beta]^2); 

This expression contains AnI[n], for example AnI[1], AnI[2]...

So if you want to get the equation of AnI[n] and Aki[k] in the same notebook, you have to remove the definition, otherwise it will fall into the endless loop, so how to remove the definition of AnI[n] and Aki[k] after I get their expression?

For example, you can get the expression of AnI[2],but I want to remove the definition of AnI[2] and AnI[n] after I get the expression, but it seems that Remove[AnI[2]] and Remove[AnI[n]] and Remove[AnI[*]] are all useless. So how to solve this?

And if there is some good idea to solve with this situation, fox example I have to get the expression of AnI[1] and AnI[2]... in the first notebook and get the expression of Aki[1] and Aki[2]... in the second notebook and solve the equations with AnI[1] and AnI[2]... and Aki[1] and Aki[2]... in the third notebook. So is there any way to define and solve all in one notebook?

Thank you very much!

$\endgroup$
6
  • $\begingroup$ Welcome to the community. Use ClearAll (ClearAll[AnI]) to remove all the definitions of a symbol like AnI[1], AnI[2], ... or Unset for a single case like: Unset[AnI[1]]. $\endgroup$ Commented Jul 11, 2022 at 3:51
  • $\begingroup$ @BenIzd, ClearAll[AnI[n], AnI[2]] can not work, and the hint is ClearAll::ssym: AnI[n] is not a symbol or a string. and ClearAll::ssym: AnI[2] is not a symbol or a string. $\endgroup$ Commented Jul 11, 2022 at 4:57
  • $\begingroup$ @BenIzd, and the Unset can not work as well, the hint is Unset::norep: Assignment on AnI for AnI[n] not found. $\endgroup$ Commented Jul 11, 2022 at 5:02
  • $\begingroup$ ClearAll should be called with only the symbol name and it will clear all the existing definitions for that symbol like ClearAll[AnI]. On the Unset message, if you don't set any value and want to unset it, it'll raise a message as you've seen. You can suppress that with Quiet. $\endgroup$ Commented Jul 11, 2022 at 5:14
  • $\begingroup$ Dear @fhrl, your questions take a lot of effort to read. You should make it as simple as possible, so that one can very clearly understand what the actual question is. For example, do not use complicated equations if much simpler equations suffice to ask your question. Please become familiar with the idea of a minimal working example (MWE) as in here. $\endgroup$ Commented Jul 11, 2022 at 6:12

1 Answer 1

1
$\begingroup$

Introduce dummy variables {aki1,aki2,anI1,anI2} and solve for them.

AnI[n_] = (-((2 n ((R1/R2)^((2 \[Pi])/\[Beta]) - (R2/ R1)^((2 \[Pi])/\[Beta])) \[Beta] Aki[ 2] (Sin[n theta1] - Sin[n (theta1 + \[Beta])]))/(R2 ((R1/ R2)^((2 \[Pi])/\[Beta]) + (R2/ R1)^((2 \[Pi])/\[Beta])) (4 \[Pi]^2 - n^2 \[Beta]^2))) - (n ((R1/R2)^(\[Pi]/\[Beta]) - (R2/ R1)^(\[Pi]/\[Beta])) \[Beta] Aki[ 1] (Sin[n theta1] + Sin[n (theta1 + \[Beta])]))/(R2 ((R1/ R2)^(\[Pi]/\[Beta]) + (R2/R1)^(\[Pi]/\[Beta])) (\[Pi] - n \[Beta]) (\[Pi] + n \[Beta]))) /. {Aki[1] -> aki1, Aki[2] -> aki2}; Aki[k_] = (\[Beta] ((2 R2 (R2/R3 + R3/R2) CnI[ 1])/((R2/R3 - R3/R2) \[Beta]) + (4 R3 DnI[ 1])/((-(R2/R3) + R3/R2) \[Beta])) (-\[Beta] Cos[ theta1] + \[Beta] Cos[k \[Pi]] Cos[theta1 + \[Beta]] + k \[Pi] Sin[k \[Pi]] Sin[ theta1 + \[Beta]]))/((k \[Pi] - \[Beta]) (k \[Pi] + \ \[Beta])) + (\[Beta] ((2 R2 (R2/R3 + R3/R2) AnI[ 1])/((R2/R3 - R3/R2) \[Beta]) + (4 R3 BnI[ 1])/((-(R2/R3) + R3/R2) \[Beta])) (k \[Pi] Cos[ theta1 + \[Beta]] Sin[ k \[Pi]] + \[Beta] (Sin[theta1] - Cos[k \[Pi]] Sin[ theta1 + \[Beta]])))/((k \[Pi] - \[Beta]) (k \[Pi] + \ \[Beta])) + (\[Beta] ((R2 (R2^2/R3^2 + R3^2/R2^2) CnI[ 2])/((R2^2/R3^2 - R3^2/R2^2) \[Beta]) + (2 R3 DnI[ 2])/((-(R2^2/R3^2) + R3^2/R2^2) \[Beta])) (-2 \[Beta] Cos[2 theta1] + 2 \[Beta] Cos[k \[Pi]] Cos[2 (theta1 + \[Beta])] + k \[Pi] Sin[k \[Pi]] Sin[ 2 (theta1 + \[Beta])]))/(k^2 \[Pi]^2 - 4 \[Beta]^2) + (\[Beta] ((R2 (R2^2/R3^2 + R3^2/R2^2) AnI[ 2])/((R2^2/R3^2 - R3^2/R2^2) \[Beta]) + (2 R3 BnI[ 2])/((-(R2^2/R3^2) + R3^2/R2^2) \[Beta])) (k \[Pi] Cos[ 2 (theta1 + \[Beta])] Sin[k \[Pi]] + 2 \[Beta] (Sin[2 theta1] - Cos[k \[Pi]] Sin[2 (theta1 + \[Beta])])))/(k^2 \[Pi]^2 - 4 \[Beta]^2) /. {AnI[1] -> anI1, AnI[2] -> anI2}; soln = Solve[{anI1 == AnI[1] /. {aki1 -> Aki[1], aki2 -> Aki[2]}, anI2 == AnI[2] /. {aki1 -> Aki[1], aki2 -> Aki[2]}}, {anI1, anI2}] solk = Solve[{aki1 == Aki[1] /. {anI1 -> AnI[1], anI2 -> AnI[2]}, aki2 == Aki[2] /. {anI1 -> AnI[1], anI2 -> AnI[2]}}, {aki1, aki2} ] 

Didn't simplify, since it is quite slow.

$\endgroup$
1
  • $\begingroup$ Thanks a lot for your answer and suggestion of dummy variables, but in fact I think it is not convenient to use this method as you have to replace some variables always, so is there any better way? For example, the local definition? $\endgroup$ Commented Jul 11, 2022 at 5:00

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.