Re: [R] nonlinear curve fitting on a torus

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Mon, 14 Apr 2008 08:11:21 -0700

      Have you tried plotting it, e.g., like the following:

      npts = 51 # or some number
      h = seq(0, ???, length=npts)
      funh <- rep(NA, npts)
      for(i in 1:npts)funh[i] <- fun(h[i])
      plot(h, funh)

      Hope this helps. 
      Spencer        
     

Sungsu wrote:
>
> Dear Spencer.
>
> Thank you for your kind reply.
>
> I have n data points observed on the surface of a torus. I am trying
> to fit the geodesic line equation to these points on the surface:
>
> the equation is
> ‘u=h*integrate(((5+cos(v))*sqrt((5+cos(v))^2-h^2))^{-1}) from 0 to v’.
>
> I wrote the following R code to make the above function.
>
> fun<-function(h)
>
> {
>
> u<-h*integrate(((5+cos(y))*sqrt((5+cos(y))^2-h^2))^(-1)),lower=0,upper=v)$value
>
> u
>
> }
>
> Then minimized the sum of
> (1-cos(u-h**integrate(((5+cos(y))*sqrt((5+cos(y))^2-h^2))^(-1)),lower=0,upper=v)$value)
> as:
>
> nlminb(c(1),fun,lower=0,upper=9)
>
> I did not get an error, but the estimated h is 9 or 0, these are just
> boundaty values.
>
> I would like to appreciate your help.
>
>
>
> Sungsu
>
> UCR
>
> ps: you may use any sized two vectors for u and v with values from 0
> to 2pi in the above equation.
>
> ---- Original message ----
>
> *Date:* Sun, 13 Apr 2008 13:54:17 -0700
> *From:* Spencer Graves <spencer.graves_at_pdf.com>
> *Subject:* Re: [R] nonlinear curve fitting on a torus
> *To:* Sungsu <skim033_at_ucr.edu>
> *Cc:* r-help_at_r-project.org
> > Having seen no reply to this, I will offer a couple of comments
> >that may or may not be useful. Googling for "geodesic equation on a
> >torus" produced interesting hits, but RSiteSearch("geodesic
> equation on
> >a torus") found nothing. RSiteSearch("torus") returned 33 hits,
> some of
> >which referred to a package "geozoo".
> >
> > If you want a solution of a differential equation, you might
> >consider lsoda {odesolve}. The 'fda' package may also be useful.
> >
> > To say more, I'd prefer to hear more specifics from you. PLEASE
> >do read the posting guide
> "http://www.R-project.org/posting-guide.html"
> >and provide commented, minimal, self-contained, reproducible code.
> >Doing so can make it much easier for people to understand what you
> >want. If you provide code that doesn't quite work, someone who is
> >interested can copy it from your email into R and try things,
> possibly
> >generating a solution to your problem. Without a self-contained
> >example, you restrict the pool of possible respondents to people who
> >have actually worked with a "geodesic equation on a torus" -- or to
> >fools like me who are willing to expose their ignorance
> commenting on
> >something we know essentially nothing about.
> >
> > Hope this helps.
> > Spencer Graves
> >
> >Sungsu wrote:
> >> Dear R users.
> >>
> >> I have data observed on the surface of a torus, and
> >> am trying to fit the nonlinear regression using
> >>
> >> the geodesic equation on a torus. Could anyone give
> >> me a helpful advise on this problem? I would
> >> definitely appreicate your reply.
> >>
> >> Sincerely,
> >>
> >> SUNGSU KIM
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help_at_r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
>
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 14 Apr 2008 - 18:26:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Apr 2008 - 18:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive