0
$\begingroup$

I have defined a function first and then I need to integrate something to find the time (it's theoretical mechanics). I think I don't have any syntax issues but what am I doing not the way I should?

enter image description here enter image description here

I've tried wrapping the expression in Evaluate, but it gives the same result.

In case somebody would like the code, here it is:

U[x_] := Subscript[U, 0]*Tan[α*x]^2

t = 
  (Sqrt[m/2])*
    Integrate[1/Sqrt[E - U[x_]] , 
      {x, 
       1/α*Log[(A - Sqrt[A*(A - Abs[E])]/Abs[E])], 
       1/α*Log[(A + Sqrt[A*(A - Abs[E])]/Abs[E])]}]
$\endgroup$

closed as off-topic by MarcoB, m_goldberg, LCarvalho, Itai Seggev, J. M. is away Aug 8 '17 at 17:40

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – m_goldberg, Itai Seggev, J. M. is away
  • "The question is out of scope for this site. The answer to this question requires either advice from Wolfram support or the services of a professional consultant." – MarcoB, LCarvalho
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ It may just be because Mathematica doesn't know a closed form for your integral. Also, do you mean to use E in your code as an arbitrary constant? E is the basis of natural logarithms in Mathematica. Don't use variables with uppercase names, especially single-letter ones, as you risk conflicts with built-ins like this one. $\endgroup$ – MarcoB Aug 2 '17 at 21:02
  • $\begingroup$ FWIW, Integrate[1/Sqrt[a - b Tan[x]^2], x] does return a proper (elementary!) closed form. $\endgroup$ – J. M. is away Aug 4 '17 at 5:36
  • $\begingroup$ I see two issues: one major and one I don't know. Your definition of the function U is recursive, since U appears on both sides. Change the one on the left to lower-case or something else. The other is that in your definition of t, U[t_] should be U[t]. Finally, why do you have Abs[E]? E is by definition a positive number. I believe that E is supposed to be energy, but E is reserved for the number $e$ in Mathematica. In general, don't use upper case letters or capitalized words for user-defined functions and symbols. $\endgroup$ – march Aug 8 '17 at 16:10
2
$\begingroup$

When you call U in the integration, you should just say U[x], not U[x_]. You inadvertently left in the underscore pattern marker (a.k.a. Blank).

$\endgroup$
  • $\begingroup$ I changed it o U(x) still docent show anything. $\endgroup$ – Jeremy Aug 2 '17 at 17:12
  • $\begingroup$ Yeah, sorry to hear that. It was definitely a problem, and at least partly answered your question "what am I doing not the way I should", but I'm afraid I can't help beyond that. $\endgroup$ – Joel Klein Aug 3 '17 at 18:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.