Student Support Forum > General > > "Solve equation(s) with a List as Variable"

 Post Reply: Name: Email Address: Please send email when my message is replied to. Url (optional): Subject: Message: view original message? Attachment (optional): Please answer this: 2+4 =

 Original Message (ID '253500') By Bill Simpson: We have no idea what your data file is or what your resulting mag is so I'll substitute some numbers for mag. Then I'll use Map to Solve for x using each value in your mag and return the result in a list. In[1]:= mag={-1,-2,-3,-4}; w=0.005; d:=148*10^(-9); mu0:=4*Pi*10^(-7); B:=5/10000; Map[Solve[(w*d*B+mu0*#)/(2*w*B)==x*Tanh[d/(2*x)],x]&,mag] From In[6]:= Solve::tdep: The equations appear to involve the variables to be solved for in an essentially non-algebraic way. Out[6]= { Solve[-0.251==x Tanh[37/(500000000x)], x], Solve[-0.503==x Tanh[37/(500000000x)], x], Solve[-0.754==x Tanh[37/(500000000x)], x], Solve[-1.005==x Tanh[37/(500000000x)], x] } If you have "reasonable" values in mag then perhaps you will get a better solution, but it is very likely that using Solve on x Tanh[37/(500000000x)] will always fail. If that happens then you might try substituting FindRoot for Solve, perhaps like this Map[FindRoot[(w*d*B + mu0*#)/(2*w*B) - x*Tanh[d/(2*x)], {x, 1}] &, mag] Notice how I've substituted - for == in that. This still fails for me because the plot of x Tanh[37/(500000000x)] is almost zero and almost constant except for a very tiny spike near x==0, presumably because I have no idea what reasonable values for mag might be. Perhaps you will have better luck.