Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Solve equation(s) with a List as Variable' topicStudent Support Forum > General > Archives > "Solve equation(s) with a List as Variable"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
01/17/13 10:19pm

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.

URL: ,

Subject (listing for 'Solve equation(s) with a List as Variable')
Author Date Posted
Solve equation(s) with a List as Variable Markus 01/17/13 12:15pm
Re: Solve equation(s) with a List as Variable Bill Simpson 01/17/13 10:19pm
Re: Re: Solve equation(s) with a List as Variable Markus 01/18/13 09:22am
Re: Re: Re: Solve equation(s) with a List as Va... Bill Simpson 01/18/13 2:05pm
Re: Re: Re: Re: Solve equation(s) with a List a... Markus 01/19/13 06:08am
Re: Re: Re: Re: Re: Solve equation(s) with a Li... Bill Simpson 01/20/13 9:02pm
Re: Re: Re: Re: Re: Solve equation(s) with a Li... Bill Simpson 01/20/13 9:30pm
Re: Re: Re: Re: Re: Re: Solve equation(s) with ... Markus 01/21/13 12:25pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic