Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8439487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:00:58+00:00 2026-06-10T08:00:58+00:00

Simple one here, i once knew this but it has been lost over the

  • 0

Simple one here, i once knew this but it has been lost over the years.

Simple equation easy to code in R:

f(x,y) = 2x^2 + 4y^2 + 6x - 8y + 15

And i have constraints of x > 1 and y > -1.

I cant for the life of me remember how to write the constraints properly in R and the book i have is no use

Cheers for any help

Looking for the minimum and maximum

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:00:59+00:00Added an answer on June 10, 2026 at 8:00 am

    Define your function that takes a single vector of arguments:

    myfun <- function(xy) { 
      x <- xy[1] 
      y <- xy[2] 
    
      2*x^2 + 4*y^2 + 6*x - 8*y + 15
    }
    

    Supply starting values to optim and specify your lower bounds for x and y:

    starting_values <- c(0, 0)
    optim(starting_values, myfun, lower=c(1, -1), method='L-BFGS-B')
    

    optim output:

    $par
    [1] 1 1
    
    $value
    [1] 19
    
    $counts
    function gradient 
           2        2 
    
    $convergence
    [1] 0
    
    $message
    [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a simple one to answer, but I'm stuck, so here goes.
The request is a simple one, but is hard to google for. Here are
This is two questions in one, so here we go. I have a simple
This should be a simple one and I am dissapointed with myself but cant
I know this topic has been covered ad nauseam here, and other places on
probably a simple one for you developers out there I have this code to
This one may seem like a simple question, but it's really got me scratching
ok here is an easy one. I need to create a simple custom panel
This is a simple C calculation. The first one above doesn't roll over when
Here's a simple one for you guys. I need to convert the result of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.