Export FindRoot[ ] output to xls file?

Hi everyone,

I just begin my Mathematica learning. I have a question about complex equation solving and data output. Details were showed below.

The equation is 6.429651.21663ln[1+0.00255*(p0.1/x)^(1/1.21663)]+1.44638ln[1+0.26895p0.1/x]=4.498351.18924ln[1+0.00168*(p0.9/(1-x))^(1/1.18924)]+0.85764ln[1+0.03736p0.9/(1-x)]

I know the range of p, and I need to get a set of solutions to the equation. The independent variable p is a positive number in the range of 0 to 100. I will select 25 numbers in this range and calculated the corresponding x. What’s more, I wish the output data could be in the xls file which I could analysis it by other software.

Then I did the program showed in attachment.

I can see the results, however, I wish the out put xls could reflect the data more clearly and simple that one line could show the value p and another line could show the x. And each two corresponding values could be showed in the same row.

I wish you can give me some suggestions to rewrite the program more easily, especially the xls file output.

Thank you very much.

Perhaps

Export["c.xls",Transpose[Table[{p,x}/.FindRoot[...

Or maybe this?

Export[
 	"c.xls",
 	Table[
  		{
   			p,
   			x /.FindRoot[
     			6.42965*1.21663*Log[1 + 0.00255*(p*0.1/x)^(1/1.21663)] +
       			1.44638*Log[1 + 0.26895*p*0.1/x] ==
      			4.49835*1.18924*Log[1 + 0.00168*(p*0.9/(1 - x))^(1/1.18924)] +
       			0.85764*Log[1 + 0.03736*p*0.9/(1 - x)],
     			{x, 0.1}
     		]
   		},
  		{p, 4, 100, 4}
  	]
 ]

Thank you very much.

Your method works pretty well. It satisfied all I need.

Hi Hans,

I tried to follow your program to solve the ternary equation, following is the equation detail:

n = ((1.60856*0.73331*p1^(1/1.44247))/(1 +  0.73331*p1^(1/1.44247)) + (1.60856*0.73325*p1^(1/1.44239))/(1 + 0.73325*p1^(1/1.44239))) == ((2.09702*0.07621* p2^(1/1.43739))/(1 + 0.07621*p2^(1/1.43739)) + (2.11532*5.11472* p2^(1/1.07083))/(1 + 5.11472*p2^(1/1.07083)))

Three variables are n, p1 and p2.

I know the range of n between 0 to 3.2. I select 20 numbers in this range to calculate the correspond values p1 and p2.

The effect looks not success which was showed in the attached picture.

Can you help me have a check?

Thank you very much.

Hi. Try this:

Export[
 	"g.xls",
 	Table[
  		{n, p1, p2} /.
   		FindRoot[
    		{
     		n == ((1.60856*0.73331*p1^(1/1.44247))/(1 + 0.73331*p1^(1/1.44247)) +
        		(1.60856*0.73325*p1^(1/1.44239))/(1 + 0.73325*p1^(1/1.44239))) ==
      		((2.09702*0.07621*p2^(1/1.43739))/(1 + 0.07621*p2^(1/1.43739)) +
        		(2.11532*5.11472*p2^(1/1.07083))/(1 + 5.11472*p2^(1/1.07083))) == h
     		},
    		{{n, h}, {p1, 0}, {p2, 0}}
    	],
  		{h, 0, 3.2, 3.2/20}
  	]
 ]

Thank you very much.

Here is a variation:

Export[
 	"g.xls",
 	Table[
  		    Prepend[
   			{p1, p2} /. FindRoot[
     		    {
      		        n == ((1.60856*0.73331*p1^(1/1.44247))/(1 + 0.73331*p1^(1/1.44247)) +
         			        (1.60856*0.73325*p1^(1/1.44239))/(1 + 0.73325*p1^(1/1.44239))),
      		        n == ((2.09702*0.07621*p2^(1/1.43739))/(1 + 0.07621*p2^(1/1.43739)) +
         			        (2.11532*5.11472*p2^(1/1.07083))/(1 + 5.11472*p2^(1/1.07083)))
      		    },
     		   {{p1, 0}, {p2, 0}}
     		],
   		  N[n]
   		],
  		{n, 0, 32/10, 32/200}
  	]
 ]