Problem? Definite integral with variable limits

Problem? Definite integral with variable limits - Messages

#1 Posted: 7/22/2009 6:58:15 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Andrey,

Please look at the picture:

I can not understand this. There must be something in the definite integral realization in SMath.
1. The function defined F(x) as definite integral with variable limit x can be defined
2. Calling this function will give the result
3. Plotting of this function is not possible???
4. Solve, f.e. with this function will not give the result???

Could you give me some hints what is this about?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#2 Posted: 7/22/2009 7:13:52 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

On the other hand, this is working

But, this is wrong???

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Posted: 7/22/2009 8:33:49 PM
jakobg

jakobg

0 likes in 21 posts.

Group: User

Hi Radovan,

I think the problem you have found is issued in a topic before (see: http://en.smath.info/forum/default.aspx?g=posts&t=85)
The definite integral is only nummerically implemented so far (at least it was the days when the other post was written), therefore it is impossible to plot the solution of a definite integral. Of course there is no problem with numerically solving it.
If you try to symbolically solve your integral, there will be an error (limits must be real).

So currently it is simply not possible to symbolically integrate.

But why the plot is wrong, Andrey has to answer.

Ciao Jakob
#4 Posted: 7/22/2009 11:35:23 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3730 posts.

Group: Super Administrator

About wrong plot results in the second example: do you really sure in your example? I thing you should use [MATH]F(x)←int(t^3+10;t;0;x)[/MATH] instead of [MATH]F(x)←int(x^3+10;x;0;x)[/MATH].

And about integral: evaluation of integral in SMath Studio is numeric, but some actions that you test requires symbolic result of the expression inside. That's why you can't evaluate some stuff in your first calculation. jakobg pointed this rightly.
#5 Posted: 7/23/2009 12:16:22 AM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3730 posts.

Group: Super Administrator

Here is the example of Definite Integral plotting by points:
#6 Posted: 7/23/2009 6:23:24 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote


I think the problem you have found is issued in a topic before (see: http://en.smath.info/forum/default.aspx?g=posts&t=85)


Thanks Jacob. Unfortunately, I can not access this topic (access is denied for me ??)
Wrote


The definite integral is only nummerically implemented so far (at least it was the days when the other post was written), therefore it is impossible to plot the solution of a definite integral. Of course there is no problem with numerically solving it.
If you try to symbolically solve your integral, there will be an error (limits must be real).

So currently it is simply not possible to symbolically integrate.


I understand all of this. About plotting, you are right - my mistake, sorry.
I am not sure about "solve" function. It seems that the function for which we are finding roots must be also given analitically. I am not sure but I made some example that involved summation. "Solve" did not solve the original function until I represent it symbolically using SMath.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#7 Posted: 7/23/2009 6:50:02 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote

About wrong plot results in the second example: do you really sure in your example? I thing you should use [MATH]F(x)←int(t^3+10;t;0;x)[/MATH] instead of [MATH]F(x)←int(x^3+10;x;0;x)[/MATH].

And about integral: evaluation of integral in SMath Studio is numeric, but some actions that you test requires symbolic result of the expression inside. That's why you can't evaluate some stuff in your first calculation. jakobg pointed this rightly.



Thanks Andrey,

I understood that. I intentionally put this, because many times this happened to my students in Mathcad. I was expecting that some error should be issued in SMath with this expression when, say, plotting it.
[MATH]F(x)←int(x^3+10;x;0;x)[/MATH]
But, it worked and I was puzzled about it?. In the first place, how this could be plotted (wrongly) considering the rules about plotting and definite integral as numerically solved?
This might cause problems in Mathcad in spite of that it could solve it analitically, until you use the correct expression (the limit variable should not be the same as the variable in the primitive function) say
[MATH]F(x)←int(t^3+10;t;0;x)[/MATH]

Your example about plotting the function with definite integrals is quite understandable and this plot is right, but please take a look at your (correct) plot and the one I mentioned incorrect (the blue line represents F(x)). What is this about?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#8 Posted: 7/23/2009 6:51:35 AM
jakobg

jakobg

0 likes in 21 posts.

Group: User

Hi Radovan,

I see what you mean with this Solve function. Well I think the Solve function uses something like a Newton sceme to find the roots and therefore the function itself (and not just a few Points - if solved numerically) is necessary to solve the equation. So if you try the line solve(F(x),x,-4,0) SMath might intent to build something like dF(x)/dx which is not available symbolical! And therefore there is no way to solve this.

Ciao
Jakob
#9 Posted: 7/23/2009 6:53:15 AM
jakobg

jakobg

0 likes in 21 posts.

Group: User

Oh damn!! Sorry RADOVAN!!! It was just a typo error, I swear!!
Jakob
#10 Posted: 7/23/2009 6:56:59 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote

Oh damn!! Sorry RADOVAN!!! It was just a typo error, I swear!!
Jakob


Sorry Jakob, what typo ???
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#11 Posted: 7/23/2009 7:03:37 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote


Well I think the Solve function uses something like a Newton sceme to find the roots and therefore the function itself (and not just a few Points - if solved numerically) is necessary to solve the equation.



If this is the case i.e. Newton like procedure with analitical derivatives, it is quite understandable then.

Thanks Jakob,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#12 Posted: 7/23/2009 8:22:40 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote


I am not sure about "solve" function. It seems that the function for which we are finding roots must be also given analitically. I am not sure but I made some example that involved summation. "Solve" did not solve the original function until I represent it symbolically using SMath.


Actually, I was wrong - sorry

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#13 Posted: 7/23/2009 1:18:55 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3730 posts.

Group: Super Administrator

omorr, thanks for the example above. I think jakobg talk about typo in the url. Here is a right one: http://en.smath.info/forum/default.aspx?g=posts&t=85
#14 Posted: 7/23/2009 1:40:48 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

You are welcome and thank you;

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#15 Posted: 7/23/2009 10:10:05 PM
jakobg

jakobg

0 likes in 21 posts.

Group: User

Hi,

well, actually my typo was something different, but if nobody "found" it, I am not going to mention it here.
An interesting topic is, I have copied the url from my adress bar and I too get the error access denied.
Thanks Andrey for the link, this was the post I was talking about.

Ciao Jakob
#16 Posted: 2/19/2010 4:12:51 PM
sleschke

sleschke

0 likes in 13 posts.

Group: User

Hello Andrey,

I just came across a related problem with definite integrals.
I tried to calculate a definite integral of a piecewise linear function.

Therefor I have defined a function

f(x):= if x <5
3
else
5

If I try to calculate the integral from 0 to 10 of f(x) dx
I get the message that x is undefined.

Regards
Stephan

P.S. I still have no idea how to insert screen shots.
Is there any tutorial about this?
#17 Posted: 2/19/2010 7:23:39 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Stephan,
Wrote

Therefor I have defined a function

f(x):= if x <5
3
else
5

If I try to calculate the integral from 0 to 10 of f(x) dx
I get the message that x is undefined.


It was mentioned in some other posts (for example "int" does not like "if"?) I suppose this is due to the internal SMath
numerical integration. If you want to integrate a discontineous function try something like this:
[MATH]f(x)←(x<5)*3+(x≥5)*5[/MATH]
[MATH]int(f(x);x;-4;8)=42,04[/MATH]
(Pay attention on the numerical error, the result is 42 actually. Try to avoid using this or see the example on Wiki)
Wrote


P.S. I still have no idea how to insert screen shots.
Is there any tutorial about this?


Put it on some free file hosting and make a link to it via "Create link" tool when posting.

Regards,
Radovan

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#18 Posted: 2/19/2010 11:28:35 PM
Greg Locock

Greg Locock

0 likes in 53 posts.

Group: User

Another alternative would be to add a page to the wiki with your note, and then upload a file or screenshot there.
#19 Posted: 2/20/2010 10:12:13 AM
sleschke

sleschke

0 likes in 13 posts.

Group: User

Hello Radovan,

thank you very much for the quick reply and the helpful links.
I will try to split my definite integral into sections where my function is continous.

Regards
Stephan

Also thanks to Greg for the hint with the wiki.
#20 Posted: 7/26/2013 6:17:28 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

There still (as of 0.96.4909) seems to be a problem to plot functions involving definite integrals. You have to embed them into eval(), otherwise they give a useless error message (claiming that the integration variable is not defined)

The X-Y Plot plugin does not seem to have that problem. A workaround might be to apply eval() for expressions to be plot
by default. At least I am not aware of counter-indications.
intplot.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
  • New Posts New Posts
  • No New Posts No New Posts