Thread Subject: solve equations for integral limits?

Subject: solve equations for integral limits?

From: David Doria

Date: 1 May, 2008 15:49:03

Message: 1 of 10

syms x k;

solve('int(x^2,0,k)=2','k')

matlab wont run this... why can I not solve that equation??

Subject: solve equations for integral limits?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 1 May, 2008 17:36:12

Message: 2 of 10

In article <fvcopf$mfa$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:
>syms x k;

>solve('int(x^2,0,k)=2','k')

>matlab wont run this... why can I not solve that equation??

I cannot test that myself as the symbolic toolbox isn't available for
Linux systems.

When, though, I test it in maple directly, maple quickly returns:

[6^(1/3), ...
 -1/2*6^(1/3)+1/2*I*3^(1/2)*6^(1/3), ...
 -1/2*6^(1/3)-1/2*I*3^(1/2)*6^(1/3)]

Maple would run the int() before attempting to solve(), so this
is equivilent to asking maple to solve(k^3/3=2)
--
  "To burn always with this hard, gem-like flame, to maintain this
  ecstasy, is success in life." -- Walter Pater

Subject: solve equations for integral limits?

From: David Doria

Date: 1 May, 2008 17:51:03

Message: 3 of 10

so realizing that solve() uses maple... I used maple syntax:

solve('int(x,x=0..k)=1/2','k')

and it kind of works... the problem is that it returns [1,
-1]. 1 is clearly the correct solution, and -1 seems to be
wrong... because if you integrate from 0 to -1, you have to
switch the limits and change the sign... so you actually get
-1/2, not 1/2 as requested...
 
thoughts?

Subject: solve equations for integral limits?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 1 May, 2008 18:06:23

Message: 4 of 10

In article <fvcvu6$ld4$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:
>so realizing that solve() uses maple... I used maple syntax:

>solve('int(x,x=0..k)=1/2','k')

>and it kind of works... the problem is that it returns [1,
>-1]. 1 is clearly the correct solution, and -1 seems to be
>wrong... because if you integrate from 0 to -1, you have to
>switch the limits and change the sign... so you actually get
>-1/2, not 1/2 as requested...

Recall what I said about maple doing the int() before it does the
solve. The int() is going to be k^2/2, and solving k^2/2=1/2
is going to give +/- 1.
--
'Roberson' is my family name; my given name is 'Walter'.

Subject: solve equations for integral limits?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 1 May, 2008 18:12:39

Message: 5 of 10

In article <fvcvu6$ld4$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:
>so realizing that solve() uses maple... I used maple syntax:

>solve('int(x,x=0..k)=1/2','k')

>and it kind of works... the problem is that it returns [1,
>-1]. 1 is clearly the correct solution, and -1 seems to be
>wrong... because if you integrate from 0 to -1, you have to
>switch the limits and change the sign... so you actually get
>-1/2, not 1/2 as requested...

int(x,x=a..b) is b^2/2-a^2/2
so int(x,x=-1..0) is 0^2/2-(-1)^2/2 = -1/2
so int(x,x=0..-1) is the negative of that, and -(-1/2) is 1/2.
Thus k=-1 is a correct solution to the problem.
--
   "No one has the right to destroy another person's belief by
   demanding empirical evidence." -- Ann Landers

Subject: solve equations for integral limits?

From: David Doria

Date: 1 May, 2008 18:19:02

Message: 6 of 10

right - but that is not very useful because if I'm unsure of
the domain of the correct answer then I still don't know the
answer! Surely there is a function that can do this properly??

Subject: solve equations for integral limits?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 1 May, 2008 18:35:36

Message: 7 of 10

In article <fvd1im$oli$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:
>right - but that is not very useful because if I'm unsure of
>the domain of the correct answer then I still don't know the
>answer! Surely there is a function that can do this properly??

You haven't defined what you mean by "properly". k = -1 *is*
a correct answer for the problem you asked Matlab to solve,
int(x,x=0..k)=1/2 . If k < 0 is not feasible for your overall
task then that infeasibility knowledge must come from your knowledge
of the task, not from your asking Matlab to filter out solutions
that it cannot know are wrong because you are unable to tell it what
"wrong" means.

If you know the valid range of k, then you can add it as an
assumption or you can add the knowledge to the solve() call.
For example in maple directly,

> solve({int(x,x=0..k)=1/2,k>0});
                                    {k = 1}

--
   "I was very young in those days, but I was also rather dim."
   -- Christopher Priest

Subject: solve equations for integral limits?

From: David Doria

Date: 1 May, 2008 18:36:03

Message: 8 of 10

hahahahhaa man oh man - maybe I should write these things
down instead of just thinking about it - looks like I forgot
a minus sign!

Subject: solve equations for integral limits?

From: Steven Lord

Date: 2 May, 2008 14:39:20

Message: 9 of 10


"Walter Roberson" <roberson@ibd.nrc-cnrc.gc.ca> wrote in message
news:fvcv2c$h04$1@canopus.cc.umanitoba.ca...
> In article <fvcopf$mfa$1@fred.mathworks.com>,
> David Doria <daviddoria@gmail.com> wrote:
>>syms x k;
>
>>solve('int(x^2,0,k)=2','k')
>
>>matlab wont run this... why can I not solve that equation??
>
> I cannot test that myself as the symbolic toolbox isn't available for
> Linux systems.

Symbolic Math Toolbox is supported on both 32-bit and 64-bit Linux systems,
although the 64-bit Linux support was (if I remember correctly) introduced
only a few releases ago.

http://www.mathworks.com/products/symbolic/requirements.html

*checking* Yes, it looks like this toolbox was supported on 64-bit Linux
starting with Release R2007a.

> When, though, I test it in maple directly, maple quickly returns:
>
> [6^(1/3), ...
> -1/2*6^(1/3)+1/2*I*3^(1/2)*6^(1/3), ...
> -1/2*6^(1/3)-1/2*I*3^(1/2)*6^(1/3)]
>
> Maple would run the int() before attempting to solve(), so this
> is equivilent to asking maple to solve(k^3/3=2)

When I used this code in Release R2008a, I received the same result as you
received from Maple:

syms x k
solve(int(x^2, 0, k)-2, k)

--
Steve Lord
slord@mathworks.com


Subject: solve equations for integral limits?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 2 May, 2008 16:08:51

Message: 10 of 10

In article <fvf92o$n3t$1@fred.mathworks.com>,
Steven Lord <slord@mathworks.com> wrote:

>"Walter Roberson" <roberson@ibd.nrc-cnrc.gc.ca> wrote in message
>news:fvcv2c$h04$1@canopus.cc.umanitoba.ca...

>> I cannot test that myself as the symbolic toolbox isn't available for
>> Linux systems.

>http://www.mathworks.com/products/symbolic/requirements.html

>*checking* Yes, it looks like this toolbox was supported on 64-bit Linux
>starting with Release R2007a.

Looking further into ver, it looks like for some reason
we have the R2006b Symbolic and Extended Symbolic toolboxs installed.
Might be an artifact of the initial demo installation process. I'll
ask whether we have the R2007a licenses.
--
  "I like to build things, I like to do things. I am having
  a lot of fun." -- Walter Chrysler

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com