Solving for Boyle Temperature in MATLAB

  • Thread starter Thread starter nkk2008
  • Start date Start date
  • Tags Tags
    Temperature
AI Thread Summary
The discussion focuses on a MATLAB problem related to solving for Boyle temperature, specifically part 3 of a homework assignment. The user has successfully completed earlier parts but encounters issues with the integral in their code, resulting in a warning about an explicit solution not being found. They suspect the problem lies within the integral calculation and express confusion over MATLAB's output. The user also mentions considering MathCAD as an alternative but prefers to stick with MATLAB due to their familiarity. The thread highlights the challenges of implementing complex mathematical functions in MATLAB for physical problems.
nkk2008
Messages
32
Reaction score
0

Homework Statement


So I honestly had to idea where to put this. I know how to solve the problem, but I cannot get Matlab to work. This questions is more of a MATLAB question. I figured since the underlying problem was physical in nature I would post here, so forgive me if I am wrong.

The problem is attached. I have solved parts 1 and 2. It is part 3 I am having trouble with.


Homework Equations



In addition to the one given in the problem,


u(r) = 4e(((r0/r)^12)-((r0/r)^6))



The Attempt at a Solution



I have:
Code:
function problemOne

%declare symbolic Variables
N=6.023e23;
k=1.3806503e-23; %units (m^2)kg/(s^2)K
e=k*213.96; %units of k * 1/K
r0 = 426; %units of pm

syms r T;



%set y to be function inside integral in B
y=exp(((-4*e)*(((r0/r)^12)-((r0/r)^6))/k*T)-1)*(4*pi*(r^2));

%define B in terms of y
B= (-1/2)*N*int(y,r,0,Inf);

%solve for B=0;

solve(B,T)

end

This outputs:

Code:
Warning: Explicit solution could not be found. 
> In solve at 81
  In problemOne at 21
 
ans =
 
[ empty sym ]

I think the problem is in the integral, since

Code:
int(y,r,0,Inf)

yields

Code:
Inf - limit(4*pi*r^3*exp(-1)*exp(4005180207889834777988627621265408/783018253290173*T/r^6)*exp(-23937547659622311621519348000222281120506532855808/783018253290173*T/r^12), r = 0, Right)

What do I do? I thought I had a basic knowledge of Matlab (not an expert by any means), but this is confusing me to no end.

If it is easier to use MathCAD, I do have access to that. I chose not to use it because I have less knowledge of it that I do of Matlab.

Thanks,
Nkk

PS If a mod feels that this would be better suited to another homework section, please move. Again, my apologies of not knowing where to put it.
 

Attachments

Last edited:
Physics news on Phys.org
Thanks.

I actually already have a post with this exact problem in the Matlab forums. I realized that that may be the more helpful place to look after I posted this thread.

-Nkk
 
Kindly see the attached pdf. My attempt to solve it, is in it. I'm wondering if my solution is right. My idea is this: At any point of time, the ball may be assumed to be at an incline which is at an angle of θ(kindly see both the pics in the pdf file). The value of θ will continuously change and so will the value of friction. I'm not able to figure out, why my solution is wrong, if it is wrong .
TL;DR Summary: I came across this question from a Sri Lankan A-level textbook. Question - An ice cube with a length of 10 cm is immersed in water at 0 °C. An observer observes the ice cube from the water, and it seems to be 7.75 cm long. If the refractive index of water is 4/3, find the height of the ice cube immersed in the water. I could not understand how the apparent height of the ice cube in the water depends on the height of the ice cube immersed in the water. Does anyone have an...
Back
Top