Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline vroberts  
#1 Posted : 25 May 2010 21:47:26(UTC)
vroberts

Rank: Newbie

Groups: Registered
Joined: 25/05/2010(UTC)
Posts: 7
Location: New York, USA

This is a great program. As a long time Mathcad user, who has become disenchanted with the versions developed by PTC, I'm looking forward to further development of SMath.

I'm having trouble with what I think is a simple definite integral.

I can integrate sin(x) from 0 to 2*Pi without any issues. However, if I hold parts of sin(x) at 0 using the IF function, when I then try to integrate the resulting function I get a "x is not defined" error.

Any help would be appreciated.

Vic Roberts

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline maweilian  
#2 Posted : 25 May 2010 21:57:32(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
Can you post a screen shot of your problem? See the following wiki page on how to post screen shots.

Notes on Using the Forum

Thanks

Edited by user 25 May 2010 21:59:32(UTC)  | Reason: Not specified

Will Massie
Mechanical Engineer
Oregon, USA
Offline vroberts  
#3 Posted : 25 May 2010 23:31:53(UTC)
vroberts

Rank: Newbie

Groups: Registered
Joined: 25/05/2010(UTC)
Posts: 7
Location: New York, USA

The file is in a new directory called vroberts. The name is Integration Test
Offline maweilian  
#4 Posted : 25 May 2010 23:40:16(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
vroberts,

For the convenience of the forum participants, here is a link to your file:
Vroberts question
Will Massie
Mechanical Engineer
Oregon, USA
Offline vroberts  
#5 Posted : 25 May 2010 23:44:44(UTC)
vroberts

Rank: Newbie

Groups: Registered
Joined: 25/05/2010(UTC)
Posts: 7
Location: New York, USA

Thanks for adding the link. I didn't know how to so that.

Also, for completeness, this integral gives incorrect results in Mathcad using values of d close to but not exactly equal to Pi/2. It works properly in Mathematica.

Vic
Offline omorr  
#6 Posted : 26 May 2010 00:24:48(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello Vic,

Please see this post why "int" does not like "if",
You can also see the "Gauss-Legendre integration" example on the Wiki.

Generaly speaking, numerical integration of noncontinous functions should be avoided.
On the other hand, integration in SMath will not work with "if". You can try to use some construction like this to make a discontinous function in order to integrate it:
f(x)←(x<1)*x^2+(x≥1)*x^3
But pay attention, this is proone to error.

Regards,
Radovan

Edited by user 26 May 2010 00:28:57(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline vroberts  
#7 Posted : 26 May 2010 09:39:51(UTC)
vroberts

Rank: Newbie

Groups: Registered
Joined: 25/05/2010(UTC)
Posts: 7
Location: New York, USA

Radovan,

Thank you for the link to the other thread that discusses the same issue. As I said, this integral does not work in Mathcad either, but at least with SMath I know it does not work. Mathcad just gives an incorrect answer. I am quite amazed that the same integral, using the If function, works in Mathematica.

This is my first day working with SMath. I'm sure I will have other questions.

Regards,

Vic Roberts
Offline omorr  
#8 Posted : 26 May 2010 13:21:32(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello Vic,
vroberts wrote:
As I said, this integral does not work in Mathcad either, but at least with SMath I know it does not work. Mathcad just gives an incorrect answer. I am quite amazed that the same integral, using the If function, works in Mathematica.

Mathcad and SMath work in a different way concerning "if". Mathcad will work with "if" and integrals but SMath will not. Morover, SMath at the moment has a simple numerical procedure for calculating integrals. I think there is also a great chance that the integral calculated in SMath without using "if" function but using the procedure suggested in my previous post would be also wrong.
However, Mathematica uses its symbolic engine to solve the integrals, which is quite different. If you tried to solve the same problem in Mathcad numericaly and the result is wrong - problem is in Mathcad's numeric engine. If you tried to calculate it symbolicaly and the result is wrong, the problem is in Mathcad's symbolic engine (it depends which version of Mathcad you are using, that would be Maple or Mupad problem)
vroberts wrote:
This is my first day working with SMath. I'm sure I will have other questions.

It is Ok. I would suggest you to read first the Tutorials and Examples on the Wiki and the other Wiki pages as well.

Regards,
Radovan

Edited by user 26 May 2010 13:30:09(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.