Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Domain of function

Subject: Domain of function

From: Nikola Kal

Date: 17 Dec, 2013 02:40:18

Message: 1 of 7

First of all sorry because of my bad English :)

How can i get domain of function?
For example domain of function sqrt(x-3) is x>=3
Or domain of function log(x-1) is x>1 etc.
Thank you for all help...

Subject: Domain of function

From: TideMan

Date: 17 Dec, 2013 03:18:29

Message: 2 of 7

On Tuesday, December 17, 2013 3:40:18 PM UTC+13, Nikola Kal wrote:
> First of all sorry because of my bad English :)
>
>
>
> How can i get domain of function?
>
> For example domain of function sqrt(x-3) is x>=3
>
> Or domain of function log(x-1) is x>1 etc.
>
> Thank you for all help...

Matlab is quite happy evaluating log(-1) or sqrt(-3) or even log(-inf).
So, the domain for these functions is infinite.

So I guess what you mean is, you want the REAL domain?

Subject: Domain of function

From: Nasser M. Abbasi

Date: 17 Dec, 2013 10:04:14

Message: 3 of 7

On 12/16/2013 8:40 PM, Nikola Kal wrote:

> For example domain of function sqrt(x-3) is x>=3

Really? are you saying that sqrt(-10000 - 3) is not defined
becuase 10000 is smaller than 3?

Subject: Domain of function

From: Nikola Kal

Date: 20 Dec, 2013 23:53:06

Message: 4 of 7

TideMan <mulgor@gmail.com> wrote in message <a04d6161-9eb6-494d-b35e-e11650d77752@googlegroups.com>...
> On Tuesday, December 17, 2013 3:40:18 PM UTC+13, Nikola Kal wrote:
> > First of all sorry because of my bad English :)
> >
> >
> >
> > How can i get domain of function?
> >
> > For example domain of function sqrt(x-3) is x>=3
> >
> > Or domain of function log(x-1) is x>1 etc.
> >
> > Thank you for all help...
>
> Matlab is quite happy evaluating log(-1) or sqrt(-3) or even log(-inf).
> So, the domain for these functions is infinite.
>
> So I guess what you mean is, you want the REAL domain?
>
Yes, i'm looking for real domain.
There are examples:
1.domain of function sqrt(x-3) is x>=3
2.domain of function log(x-1) is x>1
3.domain of function asin(x+1) is -1<=x+1<=1
4.domain of function acos(3*x+1) is -1<=3*x+1<=1, etc.
So, if you understand can you help me?
Big thanks in advance.

Subject: Domain of function

From: Nikola Kal

Date: 22 Dec, 2013 14:55:07

Message: 5 of 7

Any help?

Subject: Domain of function

From: John D'Errico

Date: 22 Dec, 2013 15:20:07

Message: 6 of 7

"Nikola Kal" wrote in message <l96uga$cht$1@newscl01ah.mathworks.com>...
> Any help?

Easy, peasy.

function D = realDomain(fname)
% realDomain: returns the real domain of any function in matlab
% well, at least until I get bored
which fname
  case {'sin' 'cos' tan' 'exp' 'abs' 'sinh'}
    D = [-inf inf];
  case {'asin' 'acos'}
    D = [-1 1];
  case 'sqrt'
    D = [0 inf];
  otherwise
    D = 'i'm getting bored';
end

I'll let you fill out the remainder.

John

Subject: Domain of function

From: John D'Errico

Date: 22 Dec, 2013 16:32:11

Message: 7 of 7

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <l96vv7$7eq$1@newscl01ah.mathworks.com>...
> "Nikola Kal" wrote in message <l96uga$cht$1@newscl01ah.mathworks.com>...
> > Any help?
>
> Easy, peasy.
>
> function D = realDomain(fname)
> % realDomain: returns the real domain of any function in matlab
> % well, at least until I get bored
> which fname
> case {'sin' 'cos' tan' 'exp' 'abs' 'sinh'}
> D = [-inf inf];
> case {'asin' 'acos'}
> D = [-1 1];
> case 'sqrt'
> D = [0 inf];
> otherwise
> D = 'i'm getting bored';
> end
>
> I'll let you fill out the remainder.
>
> John

Let me be more clear. This is a difficult thing to do, to
return the domain of ANY general function in MATLAB.
It is also arguably not that useful a thing to most people,
which is why you have found no solution.

Would you expect to be able to get the domain of isprime?
What would it be shown as?

Since most of the functions I list above have extensions
into the complex plane, the domain is truly the set of
complex numbers, not what you have asked for.

What about functions that have multiple arguments, some
of which are not even the same class? How do you define
the "domain" in those cases?

John

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us