Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.1K Views
|
8 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Custom function is not working

Posted 3 years ago

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 ?enter image description here

Attachment

Attachments:
POSTED BY: Indranil Maiti
8 Replies
Posted 3 years ago

Thanks, everyone for your time and help!

POSTED BY: Indranil Maiti
Posted 3 years ago
POSTED BY: Eric Rimbey
Posted 3 years ago

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

POSTED BY: Indranil Maiti

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].

POSTED BY: Gianluca Gorni
Posted 3 years ago

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

POSTED BY: Bill Nelson
Posted 3 years ago

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.

POSTED BY: Rohit Namjoshi
Posted 3 years ago

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))
Attachments:
POSTED BY: Indranil Maiti
Posted 3 years ago

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

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