Python Forum
Comparing three functions and plotting specific regions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparing three functions and plotting specific regions
#1
Hi guys,

Assume that we have the following functions:
    f_1 = ((x[2]/(5+x[1]))**((x[1]+5)/4))
    f_2 = (5+x[1]*((x[2]-5)/x[1])**((x[1]+5)/4)))/(5+x[1])
    f_3 = (5*((X[2]-X[1])/5)**((x[1]+5)/4))+X[1])/(5+X[1])
[Image: e7qjh.png]

In addition, let's assume that:
 
x[1] = np.linspace(0,7,0.001)
x[2]= np.linspace(0,5+x[1],0.001)
I need to draw a plot which clarifies region under which each function is greater than the other two functions. x-axis = x[1], y-axis = x[2]

In fact, I need a plot like the following picture which shows the regions under which each function has a greater value in comparison with the other two functions. For example, in the following picture we can see that when c < x[2] < a and x[1]< b (i.e the green region) then f_1 is greater than f_2 and f_3.

**It should be mentioned that if x[2] < 5 then f_2 is undefined and if x[2] < x[1] then f_3 is undefined. In these cases we just need to compare the other two functions. For instance, suppose that x[1] = 4 and x[2] = 3, since x[2] < 5 and x[2] < x[1], then both f_2 and f_3 are undefined and we only need to consider f_1.


[Image: 2NwHI.png]
Reply
#2
It looks like an assignment. What did you try so far?
Reply
#3
First, thanks for your reply. I know that it seems that it's an assignment:D, but it's not. The whole problem is far beyond these functions. However, since I am new to python I just post a numerical example to see how can I code this problem to gain some hints for the main problem which is totally parametric.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Plotting a specific bar / rectangle chart? glantz 2 2,144 Apr-30-2020, 11:33 AM
Last Post: glantz
  Plotting climate data with NetCdf files for a specific region with coordinates fyec 3 5,336 Jun-27-2018, 12:34 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020