Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

vpasolve

146 views
Skip to first unread message

richard

unread,
Jun 12, 2014, 12:02:09 AM6/12/14
to
Hello I am trying to find a solution to the equation:

1= 0.95*2*invtan(4.5/2*r)*r/(4.5)

for the unknown r that satisfies the equality or comes as close to it as possible

I have tried using vpasolve by entering this into matlab:

syms r
vpasolve(0.95 * 2 * atan((4.5)/(2*r)) * r / (4.5) == 1,r)

but I come up with matlab saying

[ empty sum ]


I want to use matlab to solve this, can anyone help?

richard

unread,
Jun 12, 2014, 12:04:14 AM6/12/14
to

Steven Lord

unread,
Jun 12, 2014, 9:38:44 AM6/12/14
to

"richard " <richa...@embarqmail.com> wrote in message
news:lnb8o1$5ou$1...@newscl01ah.mathworks.com...
You want to find an r that makes this f equal to 0.

>> syms r
>> f = 0.95*2*atan(4.5/(2*r))*r/4.5-1

Let's plot it and see where that r may be located.

>> ezplot(f)

The function is always negative on the default range of r, [-2*pi 2*pi].
Let's expand the range of r a bit.

>> ezplot(f, [-100, 100])

Still always negative. It looks like it's increasing as r gets larger,
though; let's see the limit of f as r goes to positive and negative
infinity.

>> limit(f, r, Inf)
>> limit(f, r, -Inf)

Neither of those are positive. That suggests to me that f is always negative
and therefore your equation has no solution (at least for real r.)

When I defined r to be complex:

>> syms rp ip real
>> r = rp+1i*ip

and solved for real(f) == 0 and imag(f) == 0 SOLVE found one solution.
Substituting that back into f gave a value that was very close to 0.

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

John D'Errico

unread,
Jun 12, 2014, 9:43:08 AM6/12/14
to
"richard " <richa...@embarqmail.com> wrote in message <lnb8rt$5tn$1...@newscl01ah.mathworks.com>...
Whats the problem?

fun = @(r) 0.95*2*atan(4.5/2.*r).*r./(4.5) - 1;

ALWAYS plot your problems, especially when you had some
question.

ezplot(fun)

ezplot assures me there is a solution.

fzero(fun,1)
ans =
1.78508760596867

fzero found it simply enough.

syms r
vpasolve(0.95*2*atan(4.5/2.*r).*r./(4.5) - 1)
ans =
-1.7850876059686659560198404566581

So did vpasolve, as did solve.

John

Steven Lord

unread,
Jun 12, 2014, 10:10:37 AM6/12/14
to

"John D'Errico" <wood...@rochester.rr.com> wrote in message
news:lncapc$pq0$1...@newscl01ah.mathworks.com...
> "richard " <richa...@embarqmail.com> wrote in message
> <lnb8rt$5tn$1...@newscl01ah.mathworks.com>...
>> Hello I am trying to find a solution to the equation:
>>
>> 1= 0.95*2*invtan(4.5/2*r)*r/(4.5)
>>
>> for the unknown r that satisfies the equality or comes as close to it as
>> possible
>>
>> I have tried using vpasolve by entering this into matlab:
>>
>> syms r
>> vpasolve(0.95 * 2 * atan((4.5)/(2*r)) * r / (4.5) == 1,r)
>>
>> but I come up with matlab saying [ empty sum ]
>>
>>
>> I want to use matlab to solve this, can anyone help?
>
> Whats the problem?
>
> fun = @(r) 0.95*2*atan(4.5/2.*r).*r./(4.5) - 1;

It's unclear whether the argument of ATAN should be (4.5/(2*r)) or
(4.5/2)*r. The code richard posted uses the former, but you're using the
latter.

*snip*

John D'Errico

unread,
Jun 12, 2014, 10:22:09 AM6/12/14
to
"Steven Lord" <Steve...@mathworks.com> wrote in message <lnccd7$156$1...@newscl01ah.mathworks.com>...
I took one of the two forms posted. If r appears as a divisor,
then it looks like no solution.

fun = @® 0.95*2*atan(4.5/2 ./r).*r./(4.5) - 1;
ezplot(fun)

This shows a plot suggesting no real solution. So depending
on the needed form, there MAY be a solution. Only the Shadow
knows.

John

Steven Lord

unread,
Jun 12, 2014, 11:17:49 AM6/12/14
to

"John D'Errico" <wood...@rochester.rr.com> wrote in message
news:lncd2h$2rt$1...@newscl01ah.mathworks.com...

*snip*

> I took one of the two forms posted. If r appears as a divisor,
> then it looks like no solution.
>
> fun = @® 0.95*2*atan(4.5/2 ./r).*r./(4.5) - 1;
> ezplot(fun)
>
> This shows a plot suggesting no real solution. So depending
> on the needed form, there MAY be a solution. Only the Shadow
> knows.

There's a solution in either case. [I found one complex solution for the
other form in another message in one branch of this thread.] Whether the
solution to OP wants is real or complex depends on the form.

Christopher Creutzig

unread,
Jun 16, 2014, 3:45:05 AM6/16/14
to
On 6/12/14 6:02 AM, richard wrote:

> syms r
> vpasolve(0.95 * 2 * atan((4.5)/(2*r)) * r / (4.5) == 1,r)

Assuming you are looking for solutions in the complex plane, you may
have better luck providing some non-real start point for the search:

>> vpasolve(0.95 * 2 * atan((4.5)/(2*r)) * r / (4.5) == 1,r,1+i)

ans =

5.9290848771046631489512799270697*i

>> vpasolve(0.95 * 2 * atan((4.5)/(2*r)) * r / (4.5) == 1,r,1-i)

ans =

-5.9290848771046631489512799270697*i


HTH,

Christopher

0 new messages