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 7174145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:58:20+00:00 2026-05-28T15:58:20+00:00

I think this is a simple question for mathematica experts. How can I maximize

  • 0

I think this is a simple question for mathematica experts.
How can I maximize the extracted value from a list given a index that has to respect some constrains?

For example:

S = {4,2,3,5}

Maximize[{Extract[S,x], x<= 3, x>=1},{x}]

I would like 4 is returned instead of this error:

Extract::psl: "Position specification x in Extract[{4,2,3,5},x] is not an integer or a list of integers."

Does someone know like solve this?

Thanks a lot.


Thanks a lot!! The last approach shown is what I was looking for but applied to my real problem does not work.

I have the following problem:

I have to maximize the satisfaction of an employee with respect to a certain shift in an certain day of a month.
I have the matrix satisfaction (Employees,shifts) and is something like this:

S= {{4,3,5,2},{3,4,5,1}}

Each element represents the satisfaction of an employee with respect to a certain shift so employee 1 has satisfaction 4 with respect shift 1.

My model has to choose the right shift for all month days in order to maximize the employee satisfaction by respecting certain constraints.

My greatest problem is relate satisfaction matrix with chosen shift.
I am not able to use in method NMaximize a function that takes the chosen shifts and employee and returns the satisfaction and so doing a summation over all month days.
I need to maximize something like this:

Summation(from j=1 to j=31) getSatisfaction[1,chosenShift for that day)

Do you know how can I write this in mathematica?
I am struggling to this problem for several days but I am not able to solve this problem.
I need the input to relate chosen shift with satisfaction matrix.

Thanks a lot!!

  • 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-05-28T15:58:21+00:00Added an answer on May 28, 2026 at 3:58 pm

    If you don’t need to find the value of x then I suggest you merely extract the acceptable range of the list and then find the Max of that:

    s = {4,2,3,5};
    
    s[[1 ;; 3]] // Max
    
    4
    

    If you have particularly hairy constraints then you may need something like Pick:

    list = {5, 7, 1, 9, 3, 6, 2, 8, 4};
    
    Pick[list, Range@Length@list, x_ /; x <= 7 && x >= 3 && Mod[7, x] == 1]
    
    {1, 6} 
    

    You can then use Max on the returned list.


    For completeness, if you need the value of x or other details from the process, here is an approach:

    list = {6, 5, 7, 3, 4, 2, 1, 8, 9};
    
    pos = Cases[Range@Length@list, x_ /; x <= 7 && x >= 3 && Mod[7, x] == 1]
    
    values = Part[list, pos]
    
    maxpos = Part[pos, Ordering[values, -1]]
    
    {3, 6}
    
    {7, 2}
    
    {3}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this is a simple question, but I can not find the answer
I think this is a simple question. How do I disable copy from a
i think this is a simple question but I've searched around and can't seem
I'm hoping this question has a very simple answer. I can think of ways
I think that's a very simple question, but I can't deal with it: I
I think this is a simple question. Imagine you have a page that initializes
I think this is a really, really simple question but I can't seem to
simple question i think, but cant figure this out How can I wrap particular
I think this will be a simple question. I have an App.config that contains
I think this is a pretty simple question. How do you an apache rewrite

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.