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 omorr  
#1 Posted : 09 November 2010 12:40:39(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,

You've made a slight mistake in C.pm(T) - check the function name - should "C" be in uppercase or lowercase.

Your first "solve" will not work because you used integration, and the unknown is the upper integration limit. This will not work with neither "solve" nor "roots". Those function expect that the function you are trying to find the root is analytically given. Integration is numerically performed in SMath. In those cases you can use some "home made" root finding procedure. For instance if you made this function and insert it into your worksheet (directly or as a snippet).

file secant.sm
you can solve you problem by, say, defining this function first
f(T.2)←int(C.vm(T)/T,T,T.1,T.2)+R*ln(V.2/V.1)
and finding its root
T2←secant(f(_T.2),T.2,10^{-3})
checking
T2=308.1659 f(T2)=-3.2387*10^{-4}

As for the second "solve" I tried to plot the
S(V.1,T.1)-S(V.2,x)
and could not find where the root could be - it was always negative. There might be mistake in defining this function.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"

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

Offline omorr  
#2 Posted : 10 November 2010 09:59:45(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,
asdfghjkl wrote:
I have calculated the first part. But, I don't really understand how to use "secant" for solving this equation. why it needs to add 10^(-3) in secant function?

The secant function has three arguments

secant(f(1),x0,delta)

f(1) is the function with the the single unknown, say - "x" for which f(x)=0
x0 is the guess value of "x"
deltamax is a small number - the convergence criteria. As you could see from the function definition the iterative procedure will stop when the relative error between two subsequent iteration is smaller than the deltamax.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline omorr  
#3 Posted : 23 November 2010 19:36:51(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,

The simplest answer to your question would be - just try it. If you are convinced that there are some real roots of the given function try "solve" and "roots" first. If they do not work then try "secant". If this fail as well - then try something else. There is no numerical procedure which will give you the roots for every nonlinear functions. Some functions will fail, some will not.

On the other hand, regarding SMath, one of the situation when "solve" and "roots" will not work is when you use "eval" function.
Here is an example:
f1(x)←2*x^2+5*x-3
solve(f1(x),x,0,2)=0.5 f1(0.5)=0
This will not work:
f2(x)←eval(2*x^2+5*x-3)
solve(f2(x),x,0,2)=#
Although:
f2(0.5)=0

Regards,
Radovan

Edited by user 23 November 2010 19:53:51(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.