Custom function is not working

I have defined a function with some variable. When I am giving the value of those variables it is not giving me the value. What is the reason ?

You define the function f to have 5 parameters

but when you use the function f you only give it 4 parameters

so Mathematica thinks that f with 4 parameters is a different unknown function.

And there is no _ following your λ in your function definition

And there appears to be a space between the Subscript expressions and the _.

Please post code that can be copied, pasted, and evaluated, not an image. As someone on MSE said

When you want your car to be repaired, you bring it to a workshop, not
just show a photo to the mechanics. When you want your question to be
answered, you post your code, not just a photo of it.

Also, when you define a function like f[x_] := 2 x, the variable x must be a simple symbol, not a composite expression like Subscript[Y,0,A].

here I am giving the code.

f[Subscript[Y, 0, A] _, Subscript[Y, 0, B] _, Subscript[\[Eta], A] _, 
  Subscript[\[Eta], 
    B] _, \[Lambda]_  ] = (1 - ((1 - 
       Subscript[Y, 0, A])/(1 + 
        Subscript[\[Eta], A]*\[Lambda])^2) - ((1 - 
       Subscript[Y, 0, B])/(1 + 
        Subscript[\[Eta], B]*\[Lambda])^2) + ((1 - 
       Subscript[Y, 0, A])*(1 - 
        Subscript[Y, 0, B])/(1 + Subscript[\[Eta], A]*\[Lambda] + 
         Subscript[\[Eta], B]*\[Lambda] - 
         Subscript[\[Eta], A]*Subscript[\[Eta], B]*\[Lambda])^2))

Mikolaj_1st task_9.12.2022.nb (16.3 KB)

I have corrected that part but the problem has not resolve yet. Here I am sending the code you can check from there.

Mikolaj_1st task_9.12.2022.nb (16.3 KB)

To use the simple notation for Pattern, e.g. x_, you need the “x” part to be a symbol. Otherwise Mathematica will interpret that expression differently. For example, look at

Subscript[Y, 0, A] _ // FullForm

It gives Times[Blank[], Subscript[Y, 0, A]], which is not a Pattern expression at all. What your definition of f ended up being was a definition for a single, specific f-headed expression. That is, if you evaluate

f[Subscript[Y, 0, A] _, Subscript[Y, 0, B] _, Subscript[\[Eta], A] _, Subscript[\[Eta], B] _, \[Lambda]_  ]

you will get a new expression, but it will be the exact expression you provided with no argument replacements happening.

I find using Subscript for variables very tedious, verbose, and error-prone, so I’m going to show you one way to define your function, but with more typical argument patterns. I’m also going to avoid special named characters, because it just clutters things up when posting code to this forum.

f2[Y0A_, Y0B_, etaA_, etaB_, lambda_] := 
  (1 - ((1 - Y0A)/(1 + etaA*lambda)^2) - ((1 - Y0B)/(1 + etaB*lambda)^2) + 
  ((1 - Y0A)*(1 - Y0B)/(1 + etaA*lambda + etaB*lambda - etaA*etaB*lambda)^2))

Notice I used := instead of =. That’s not absolutely necessary, but it avoids problems if you had previous definitions for the symbols appearing here.

Test:

f2[10^-5, 10^-5, 10, 10, 10^-2]

gives 1178376600121/48400000000

Thanks a lot! It helps me and also the way you showed is very easy to use.

Thanks, everyone for your time and help!