Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem in solving simaltaneous eqn.

Subject: problem in solving simaltaneous eqn.

From: mbbajaj

Date: 11 Dec, 2008 12:42:42

Message: 1 of 6

Hello matlab users
  solving the set of eqns. using solve given below returns warning
         

[ a b c]= solve('a+b*(35226)^1/c=20.55*10^6','a+b*(0.233*10^6)^1/c=11.68*10^6','a+b*(0.5304*10^6)^1/c=7.26*10^6')
Warning: Explicit solution could not be found.
> In solve at 140
 
a =
 
[ empty sym ]
 
 

b =

     []


c =

     []

How do i solve above eqn. mentioned in function solve

Subject: problem in solving simaltaneous eqn.

From: arindam

Date: 11 Dec, 2008 12:57:13

Message: 2 of 6

A probably very unhelpful update ... I put the (1/c) term in brackets and look at what I got --- I dont think this function can solve this equation.

>> [a,b,c]=solve('a+b*(35226)^(1/c)=20.55*10^6','a+b*(0.233*10^6)^(1/c)=11.68*10^6','a+b*(0.5304*10^6)^(1/c)=7.26*10^6')
 
a =
 
(Inf)
 
 
 
b =
 
(-Inf)
 
 
 
c =
 
(Inf)

Subject: problem in solving simaltaneous eqn.

From: Joerg Buchholz

Date: 11 Dec, 2008 14:47:02

Message: 3 of 6

arindam <goswamiarindam@gmail.com> wrote in message <21536849.1229000264483.JavaMail.jakarta@nitrogen.mathforum.org>...
> A probably very unhelpful update ... I put the (1/c) term in brackets and look at what I got --- I dont think this function can solve this equation.
>
> >> [a,b,c]=solve('a+b*(35226)^(1/c)=20.55*10^6','a+b*(0.233*10^6)^(1/c)=11.68*10^6','a+b*(0.5304*10^6)^(1/c)=7.26*10^6')
>
> a =
>
> (Inf)
>
>
>
> b =
>
> (-Inf)
>
>
>
> c =
>
> (Inf)

R2008b says:

[a,b,c]=solve('a+b*(35226)^(1/c)=20.55*10^6','a+b*(0.233*10^6)^(1/c)=11.68*10^6','a+b*(0.5304*10^6)^(1/c)=7.26*10^6')
 
a =
 
63010684.563921306004801347350961
 
 
b =
 
-14839253.094666345512870584740944
 
 
c =
 
9.9586351260721812366299239623002

Subject: problem in solving simaltaneous eqn.

From: arindam

Date: 12 Dec, 2008 06:56:21

Message: 4 of 6

The results I posted are R2007a.
Do you think I need an upgrade to fix this issue, or tinker with MATLAB settings(newbie alert)?

Subject: problem in solving simaltaneous eqn.

From: Joerg Buchholz

Date: 12 Dec, 2008 10:43:02

Message: 5 of 6

arindam <goswamiarindam@gmail.com> wrote in message <22965406.1229065011865.JavaMail.jakarta@nitrogen.mathforum.org>...
> The results I posted are R2007a.
> Do you think I need an upgrade to fix this issue, or tinker with MATLAB settings(newbie alert)?

If can solve your problem numerically in R2007a. Write an m-file (cost.m) with your cost function:

function cost_value = cost (x)
a = x(1);
b = x(2);
c = x(3);
cost_value = [ ...
    a+b.*(35226).^(1./c)-20.55e6; ...
    a+b.*(0.233e6).^(1./c)-11.68e6; ...
    a+b.*(0.5304e6).^(1./c)-7.26e6 ...
    ];

and call it with appropriate initial values:

>> format long
>> fsolve (@cost, [1e8; -1e7; 10])
Optimization terminated: norm of relative change in X is less
 than max(options.TolX^2,eps) and sum-of-squares of function
 values is less than sqrt(options.TolFun).

ans =

  1.0e+007 *

   6.301068456392133
  -1.483925309466637
   0.000000995863513

I would not recommend to upgrade to R2008b. The MuPAD-Matlab interface has too many bugs.

Subject: problem in solving simaltaneous eqn.

From: Walter Roberson

Date: 13 Dec, 2008 05:42:03

Message: 6 of 6

arindam wrote:
> A probably very unhelpful update ... I put the (1/c) term in brackets and look at what I got ---
> I dont think this function can solve this equation.

>>> [a,b,c]=solve('a+b*(35226)^(1/c)=20.55*10^6','a+b*(0.233*10^6)^(1/c)=11.68*10^6','a+b*(0.5304*10^6)^(1/c)=7.26*10^6')

If you replace your numeric constants with symbolic variables, and explicitly solve over [a,b,c],
then you will get long symbolic formula for a, b, and c, that do not immediately appear
to imply that the solutions must be infinity. However, drop in just about any numeric value
for the first constant shown, 35226, and simplify(), and the infinite / indeterminate answers
pop out. The symbolic solution for [a, b, c] involves the RootOf() an expression, and 0
is a root of that expression for all possible numeric constants, as long as that first
numeric constant is not either 0 or 1 (there is a division by the ln of that numeric constant.)
When the 0 root comes out, the infinite or indeterminate answers appear.

If, though, you extract the expression inside the RootOf and solve() for all of the symbolic
variables you used to represent the numeric constants, leaving "free" only the dummy variable
_Z that is used in the RootOf, you get a bunch of solutions, most of which require that one
of the numeric constants happens to equal another of the numeric constants. But one of
the solutions leaves all of the numeric constants "free" except that it writes the
equated value of the second equation (the 11.68*10^6 in the above) in terms of the
other values. If you plug in the values from the first and third equations above, and
study the relationship between the number being raised to the power (the 0.233*10^6)
and the equated value (the 11.68*10^6), you find an asymptotic curve flattening as
the equated value increases... and in the region of 11.68*10^6, unless you calculate
to a large number of digits, the value computed as the numeric constant that can
have the arbitrary RootOf() solution, is indistinguishable from 0.233*10^6.

So... the situation is not actually that the symbolic engine (at least the Maple based
one) is mis-calculating roots: the equations happen to be such that you would need to
calculate to a relatively high precision to get those non-trivial solutions that
can theoretically occur as you vary the numeric constants -- a precision use which
would not be warranted considering that the numeric constants are only given
to four digits.

The equations are, in other words, numerically unstable near the constants
in the question; the trivial solution found is always present for all constants
(other than 1); and finding the non-trivial solutions symbolically would be
ineffective in that range (that is, the numeric solutions found vary broadly
depending upon -exactly- how the equations were simplified or factored or re-written.)

--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us