-1

I typed a function :

 f := Tan[(1/a)*Log[(Sqrt[x^2 + y^2])]] - y/x

I assigned values:

a = 6.045059888;
x = 8.36488;
y = 1.836539;

When I used

Evaluate[f]

it gave me a value of 0.15145

However, the correct value (verified on calculator and Excel), is supposed to be -0.064. Anyone know what is wrong with this?

Regards Corse

chris
  • 22,860
  • 5
  • 60
  • 149
Corse
  • 459
  • 2
  • 7
  • 1
    Code is ok, Log has base E, not 10. With Log10 you will get what you need. P.s. Evaluate is redundant here. – Kuba Apr 09 '15 at 07:39
  • how to evaluate the expression? – Corse Apr 09 '15 at 07:46
  • Use only f. p.s. If you want to create the function, maybe better use named arguments f[a_,x_, y_]:=... because your way works only if a x y were not defined earlier. – Kuba Apr 09 '15 at 07:48
  • when i changed it to named arguments, Evaluate[f] just yields f . strange – Corse Apr 09 '15 at 07:59
  • 1
    Do Remove[f], then redefine your function using the f[a_, x_, y_]:=... form, then apply your newly defined function f[a,x,y]. – TransferOrbit Apr 09 '15 at 08:18

1 Answers1

3

You're using the log with base $e$ instead of base 10.

Tan[1/a Log[Sqrt[x^2 + y^2]]] - y/x /. {a -> 6.045059888, 
  x -> 8.36488, y -> 1.836539}
0.15145


Tan[1/a Log[10, Sqrt[x^2 + y^2]]] - y/x /. {a -> 6.045059888, 
  x -> 8.36488, y -> 1.836539}
-0.0640291
Julian
  • 492
  • 4
  • 9