Skip to content

solve the equation in R

4 messages · Pei-Ling Lin, R. Michael Weylandt, Petr Savicky +1 more

#
Hi all,

I need to solve this following equation which the unknown value (here is "a") is on the exponent place, could anybody please help me to figure it out? I tried to use lm.sol() or solve() function but it doesn't work...... 

Thanks for help,
Peiling 


  (x,   y) = (2.21, 1.01)

  y = 1 + x - ( 1 + (x)^a)^(1/a)
#
You could probably find a way to do this using nls(), optim() or
uniroot() but this seems to be very much a homework problem so I won't
say more.

solve() solves matrix linear equations... not what you want here. Read
the docs.

Michael
On Thu, May 17, 2012 at 2:53 PM, Pei-Ling Lin <barthealin at gmail.com> wrote:
#
On Thu, May 17, 2012 at 01:53:39PM -0500, Pei-Ling Lin wrote:
Hi.

First, plot the function

  f <- function(a) { 1 + x - ( 1 + (x)^a)^(1/a) - y }
  x <- 2.21
  y <- 1.01
  a <- seq(0.1, 20, length=1000)
  plot(a, f(a), ylim=c(-0.2, 0.2), type="l")
  abline(h=0)

This suggests, that there is no root. This may also be obtained
analytically.

Hope this helps.

Petr Savicky.
#
On 17-May-2012 21:50:17 Petr Savicky wrote:
Well, certainly no solution for Y > 1. But if y < 1 then there
is a solution. Was the problem stated correctly?
Ted.

-------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at wlandres.net>
Date: 17-May-2012  Time: 23:27:09
This message was sent by XFMail