Skip to main content
deleted 81 characters in body; edited tags
Source Link
Szabolcs
  • 238.9k
  • 32
  • 653
  • 1.3k

guys. I am a newbie who would like to get your help. IsIs there any way to use the head of IntegerInteger and RealReal together like below? The below is not right, I know that, it is just for showing my thought.

f[x_(Integer||Real)] :=x^2;= x^2 

The reason I ask this is because I need a function that receivereceives an argument which is either integer or real.

Thank you for your help guys. :)

guys. I am a newbie who would like to get your help. Is there any way to use the head of Integer and Real together like below? The below is not right, I know that, it is just for showing my thought.

f[x_(Integer||Real)]:=x^2; 

The reason I ask this is because I need a function that receive an argument which is either integer or real.

Thank you for your help guys. :)

Is there any way to use the head of Integer and Real together like below? The below is not right, I know that, it is just for showing my thought.

f[x_(Integer||Real)] := x^2 

The reason I ask this is because I need a function that receives an argument which is either integer or real.

Source Link

Is there any way to use head of Real and Integer altogether?

guys. I am a newbie who would like to get your help. Is there any way to use the head of Integer and Real together like below? The below is not right, I know that, it is just for showing my thought.

f[x_(Integer||Real)]:=x^2; 

The reason I ask this is because I need a function that receive an argument which is either integer or real.

Thank you for your help guys. :)