Combining and normalizing functions in a plot

  • Thread starter Thread starter SoggyBottoms
  • Start date Start date
  • Tags Tags
    Functions Plot
Click For Summary

Discussion Overview

The discussion revolves around the formulation and normalization of several mathematical functions for plotting, specifically in the context of metric cues related to the perception of distance. Participants explore how to handle variables and functions in Mathematica, particularly focusing on the normalization process for values of D1 ranging from 20 to 400 cm at a fixed height L of 160 cm.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant presents a set of functions related to metric cues but expresses uncertainty about the values of S and H, which are not provided.
  • Another participant suggests finding a scale factor for normalization based on the function α[L, D1] being equal to 1.
  • Clarification is made that α is not a typo and that b and c are defined as functions rather than unknown variables.
  • Concerns are raised about the potential complexity of the function c[S, B, D1, L] and whether it can be simplified further.
  • A participant questions the correctness of their equations and the approach to scaling functions for plotting.
  • One participant proposes setting specific values for S, H, and B to simplify the functions, focusing on how they depend on D1 and L.
  • Another participant provides a Mathematica code snippet for plotting the normalized functions but warns about the potential for misunderstanding variable roles in the code.
  • A later reply confirms that the provided code worked as intended for the participant's needs.

Areas of Agreement / Disagreement

While there is some agreement on the need to normalize the functions for plotting, there remains uncertainty regarding the correctness of the equations and the approach to scaling. Participants express differing levels of confidence in their formulations and the use of Mathematica.

Contextual Notes

Participants mention potential issues with the definitions and roles of variables in Mathematica, as well as the complexity of the functions involved. There is also a noted lack of clarity regarding the assumptions behind the functions and their intended use.

SoggyBottoms
Messages
53
Reaction score
0
I have the following formulae that I found:

Code:
h[S_, H_, D1_] := (S*H)/D1;
α[L_, D1_] := ArcTan[L/D1];
b[S_, B_, D1_, L_] := (S*B)/((D1^2 + L^2)^0.5);
c[S_, B_, D1_, L_] := 
  S*Tan[ArcCos[((D1 - B/2)^2 + (D1 + B/2)^2 + 2 L^2 - B^2)/(
     2 Sqrt[(D1 - B/2)^2 + L^2] Sqrt[(D1 + B/2)^2 + L^2])]];
a = b*c;

I have to plot these functions for values of D1 between 20 and 400 cm at a height of L = 160 cm. S and H are not given, so I'm not sure what to do with those.

To compare these functions I have to normalize them by multiplying them by a constant so that their values are all 1 at D1 = 20 cm. Then I have to plot them all in the same figure. Does anyone know how I could do this?
 
Physics news on Phys.org
If L and D1 are fixed then you can find your scale factor for α[L, D1]==1.

You have one α==Alpha, is that a typo and should be a?

You have a=b*c, are you multiplying unknown free variables or perhaps functions a,b,c?

Is there a chance you can substantially simplify the definition of c[S,B,D1,L]?
 
The alpha is not a typo, it's a different function from a. The b and c in a = b*c are not unknown variables, but the functions b[S_, B_, D1_, L_] and c[S_, B_, D1_, L_].

I've tried simplifying c[S_, B_, D1_, L_], but Mathematica doesn't return anything simpler and I have no clue how I could do it myself.

I probably should give some more info: These functions are so called metric cues, that give information about the distance of an object. These cues have certain values, like the projected size of an image on the retina. The first function, h, I calculated from this sideview image:

http://img861.imageshack.us/img861/208/50703749.jpg

I changed D to D1 and L to L1 in my functions, because Mathematica was giving me issues. The second one, alpha, I calculated from this sideview image:

http://img233.imageshack.us/img233/761/68221672.jpg

The width b of the projected image on the retina of the tile (the square with sides B), the height c of the projected image on the retina of the same tile and the area of the projected image on the retina of the tile I calculated from this sideview image:

http://img715.imageshack.us/img715/1009/35292241.jpg

The curvature of the retina did not have to be taken into account and instead should be treated as a flat vertical plane. I'm not sure all the functions I calculated are even correct, but this gives you an idea where they come from.

So now I have to plot them all in the same figure, with D1 between 20 and 400 cm, L1 fixed at 160 cm and all functions normalized to return a value of 1 at D1 = 20. No values were given for S or H. This is where I'm stuck.
 
Last edited by a moderator:
I recommend putting Mathematica aside for the moment and use your diagrams and algebra until you clearly understand the problem, the equations you need and exactly what you want. Then you can ask for a plot.
 
So...my equations are wrong?
 
SoggyBottoms said:
So...my equations are wrong?

You have Five different functions, five different variables, have said you aren't sure what to do with some of these, are saying a=b*c is multiplying functions, but that isn't at all how functions are multiplied in Mathematica, and you don't seem to be clear on how to go about scaling these so they all agree at a point.

Any one or two of those would be enough reason for me to pause and figure out exactly what I really wanted before going back to Mathematica.

Mathematica seems at times to make it too easy to
1. type a bunch of stuff in.
2. get a bunch of stuff
2A. not know what it means or
2B. get an error and not know what that means or
2C. assume whatever came out is correct or
2D. notice it must be wrong
and finally
3. not know what to do about any of this.
 
Okay, forgetting about the last two equations for a second, because I'm pretty sure the first three are correct. I think I may set S to say 2.5 cm and H and B to say 10 cm, to make the functions only depend on D (D1 for me) and L (which will be a fixed number), because we are only interested in seeing how the functions depend on the distance. Then we have:

Code:
h[D1_] := 25/D1;
α[D1_,L_] := ArcTan[L/D1];
b[D_1,L_]:= 25/((D1^2 + L^2)^0.5);

The next step is to scale them so they all return a value of 1 at D1 = 20 and L fixed at 160 cm. I could calculate this manually and just multiply the functions by whatever value I find, but I think it would look nicer to do this with mathematica...
 
Last edited:
SoggyBottoms said:
The next step is to scale them so they all return a value of 1 at D1 = 20 and L fixed at 160 cm. I could calculate this manually and just multiply the functions by whatever value I find, but I think it would look nicer to do this with mathematica...

I am away at the moment and cannot test this, so you need to verify and correct any errors.

D1=20;L=160;
h[D1_] := 25/D1;
α[D1_,L_] := ArcTan[L/D1];
b[D_1,L_]:= 25/((D1^2 + L^2)^0.5);
Plot[{h[d1]/h[D1],α[d1,L]/α[D1,L],b[d1,L]/b[D1,L]},{d1,20,400}]

so when d1==D1==20 each of the three expressions will == 1
and when d1 varies from 20 to 400 it should plot your three functions correctly scaled.

Note: This is a terrible programming style and makes it easy to misunderstand what is a parameter and what is a free variable.
 
Thanks, that worked perfectly!
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 146 ·
5
Replies
146
Views
11K