Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!feeder.news-service.com!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!.POSTED!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How can I increase this solve syntax ?
Date: Sun, 22 May 2011 22:05:42 -0700
Organization: Aioe.org NNTP Server
Lines: 35
Message-ID: <ircpv6$8tf$4@speranza.aioe.org>
References: <ircoba$dll$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: TUXTYYqX1yG7hs3zxUg7ng.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
X-Notice: Filtered by postfilter v. 0.8.2
Xref: news.mathworks.com comp.soft-sys.matlab:728146

On 5/22/2011 9:38 PM, mahdi roozbhani wrote:
> tic;
> solve('(x20-6.5563)^2+(y20-6.3529)^2+(znn-1)^2=(1+1)^2','(x20-4.7476)^2+
>  (y20-4.0166)^2+(znn-1)^2=(1+1)^2','(x20-8.1058)^2+(y20-4.017)^2+(znn-1)^2=(1+1)^2','x20',
>  'y20','znn');
> toc
> Elapsed time is 0.117134 seconds.
>
> the elapsed time is to high, because this solving is in the for loop for millions counters.
>
> PL help me that how can I increase the speed ?

Is the above timing from the first try? First time you call solve it is slow
(cach effect), second time should be faster.

This is what I get on my PC (second try)

EDU>> tic;
solve('(x20-6.5563)^2+(y20-6.3529)^2+(znn-1)^2=(1+1)^2','(x20-4.7476)^2+(y20-4.0166)^2+(znn-1)^2=
(1+1)^2','(x20-8.1058)^2+(y20-4.017)^2+(znn-1)^2=(1+1)^2','x20','y20','znn');
toc
Elapsed time is 0.060639 seconds.

On the same PC, this is what I get using Mathematica

-----------------------------
{time,result}=Timing[Solve[{(x20-6.5563)^2+(y20-6.3529)^2+(znn-1)^2== (1+1)^2,(x20-4.7476)^2+
(y20-4.0166)^2+(znn-1)^2== (1+1)^2,(x20-8.1058)^2+(y20-4.017)^2+(znn-1)^2==(1+1)^2},{x20,y20,znn}]];

time
---------------------------
Out[17]= 0.016000000000000014


--Nasser