Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.6K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Find maximum of a function for several parameters

I have the following function

B[C_, alfa_, x_] := (x*Sqrt[(105*C)/(8*Pi*(10 - 3*alfa))])/
   Sqrt[gmod[C, alfa, x]].

where the function gmod has been defined elsewhere and it's not relevant here. Let's specialise to the case alfa = 0. I want to find the maximum of B, for different C parameters. The values of C are taken from this list:

cList = {0.33282, 0.338, 0.34322, 0.34848, 0.35378, 0.35912, 0.3645, 0.36992}

I can manage to do it one by one, but I would like to compute this for all of them at once. I tried this:

BMax = 
 Do[FindMaximum[Bmod[i, 0, x], {x, 0.5, 1}], {i, cList[[1]], cList[[8]]}] 

but I do not get any output. Any help would be appreciated.

POSTED BY: Camilo Posada
2 Replies

Hey Ahmed,

Thank you very much for your response. Yo are right about the C variable, it has not produced problems so far, but better change the name.

POSTED BY: Camilo Posada

Hi Camilo Note: please don't use capital C as a variable, it is reserved in Wolfram language
Please try this

B[C_, alfa_, x_] := (x*Sqrt[(105*C)/(8*Pi*(10 - 3*alfa))])/
   Sqrt[gmod[C, alfa, x]];

cList = {0.33282, 0.338, 0.34322, 0.34848, 0.35378, 0.35912, 0.3645, 0.36992};

FindMaximum[B[#, 0, x], {x, 1}] & /@ cList

Also look again at the documentation FindMaximum

POSTED BY: Ahmed Elbanna
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard