How do I solve this equation in MatLab?

Find the area of the region bounded by the hyperbola 9x^2−4y^2=36 and the line x=3.
I cannot find out the proper way to input this into MatLab. It requires trig substitution so I believe the problem stems from there but I am new to MatLab and don't know what I can do to fix it.
Here is my code:
>> syms x
>> EQ = 3*sqrt(x^2-4)
EQ =
3*(x^2 - 4)^(1/2)
>> A = int(EQ,2,3)
A =
log(161 - 72*5^(1/2)) + (9*5^(1/2))/2
>>
Here is the actual answer to the problem:
(9/2)*sqrt(5) - 6*ln((3 + sqrt(5))/2)

 Accepted Answer

Why worry the final answer is same right?
syms x
eq = 3*sqrt(x^2-4) ;
A1 = int(eq,2,3) ;
A2 = (9/2)*sqrt(5) - 6*log((3 + sqrt(5))/2) ;
[double(A1) A2]
ans = 1×2
4.2878 4.2878

4 Comments

Isaac Hewitt
Isaac Hewitt on 24 Jun 2021
Edited: Isaac Hewitt on 24 Jun 2021
Can you explain this more, how is this the same answer?
Yeah I just did this and I have no idea how you did this at all. Please explain what is happening.
Answer is converted into double from symbolic class.
Isaac Hewitt
Isaac Hewitt on 24 Jun 2021
Edited: Isaac Hewitt on 24 Jun 2021
What does that mean? I just downloaded MatLab for a class a few days ago, I have no idea what that means.
I ask this because in all my calculations
log(161 - 72*5^(1/2)) + (9*5^(1/2))/2 = 7.55445
(9/2)*sqrt(5) - 6*ln((3 + sqrt(5))/2) = 4.28776
format long g
syms x
eq = 3*sqrt(x^2-4)
eq = 
A1 = int(eq,2,3)
A1 = 
A2 = (9/2)*sqrt(5) - 6*log((3 + sqrt(5))/2)
A2 =
4.28776399803381
simplify(A1 - A2)
ans = 
double(A1 - A2)
ans =
2.3429264568019e-16
log(161 - 72*5^(1/2)) + (9*5^(1/2))/2
ans =
4.28776399803129
.... not 7.55445

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!