m aksem
m aksem

Reputation: 571

Writing down simple expressions in MATLAB

I've got expression

log(tan(3*pi/8))+cos(3*pi)+1/3*cos(3*pi)^2

Task is to get symbolic answer -

log(2^(1/2) + 1) - 2/3

I've been using

sym

but it returns 3867816025980321/18014398509481984 instead of symbolic answer that I need. I need someone to explain what I'm doing wrong.
Also I need some help with translating this expression expression to "PC language".

Upvotes: 0

Views: 63

Answers (1)

zhk
zhk

Reputation: 331

sym is used to create symbolic variables. You were on the right track but left out the quotation marks.

  1. sym('log(tan(3*pi/8))+cos(3*pi)+1/3*cos(3*pi)^2')

log(2^(1/2) + 1) - 2/3

"4 on the left of the radical sign" represents 4th root of your expression

  1. (1+(sin(3*(2*pi+7)/pi))^2)^(1/4)

1.0035

Is this what you were looking for?

Upvotes: 2

Related Questions