How to find the value for phi at a specific time in Mathematica?

  • Mathematica
  • Thread starter bruce999
  • Start date
  • Tags
    Mathematica
In summary, the conversation is about finding the value of phi at a specific time using a solution for a simple differential equation. The participant tried using "phi[t]/.solution" but it did not work. They then received advice to use "Evaluate[phi[t]/.solution]" and were able to successfully find the value.
  • #1
bruce999
11
1
Hello again.

I have a solution for a simple differenttial eqn. "Simpletreb=First@NDSolve[{phi''[t] == -d
Sin[phi[t]], phi[0] == (3π/4), phi'[0] == 0}, phi[t], {t, 0, 1}]"

After some plots and other calculations i need to find the value for phi at t=0.224511 so i input "phi[0.224511]/.simpletreb" but this just outputs "phi[0.224511]". I've also tried "Evaluate[phi[0.224511]/.simpletreb" with no joy.

My .nb file is here: (you have to cut and paste the link I'm afraid) "http://bruce1711.150m.com/simple trebuchet (first) final.nb"

Any ideas anyone?
 
Last edited:
Physics news on Phys.org
  • #2
bruce999 said:
Hello again.

I have a solution for a simple differenttial eqn. "Simpletreb=First@NDSolve[{phi''[t] == -d
Sin[phi[t]], phi[0] == (3π/4), phi'[0] == 0}, phi[t], {t, 0, 1}]"

After some plots and other calculations i need to find the value for phi at t=0.224511 so i input "phi[0.224511]/.simpletreb" but this just outputs "phi[0.224511]". I've also tried "Evaluate[phi[0.224511]/.simpletreb" with no joy.

My .nb file is here: (you have to cut and paste the link I'm afraid) "http://bruce1711.150m.com/simple trebuchet (first) final.nb"

Any ideas anyone?

In general:

solution=NDSolve[{y''[x]=such and such},y,{x,0,end}];

f[x_]:=Evaulate[y[x]/.solution];

Now, can use f[x] like any other function.
 
  • #3
Ok i tried that and i still get:
"Evaulate[phi[0.22]]" as the answer instead of a value. :confused:
 
  • #4
Got it now thanks Saltydog. :smile:
 

Related to How to find the value for phi at a specific time in Mathematica?

1. What is Mathematica and how is it used?

Mathematica is a computer software program used for mathematical and scientific computations. It allows users to perform complex calculations, create visualizations, and analyze data.

2. How is Mathematica different from other mathematical software programs?

Mathematica uses symbolic programming, which means it can manipulate and solve mathematical equations in a more efficient and intuitive way compared to traditional numerical programming. It also has a vast library of built-in functions and algorithms for various scientific and mathematical fields.

3. Can Mathematica handle large datasets?

Yes, Mathematica has the capability to handle large datasets and perform calculations on them quickly. It also has built-in tools for data analysis and visualization.

4. Is there a learning curve for using Mathematica?

Like any software program, there is a learning curve for using Mathematica. However, it has a user-friendly interface and comprehensive documentation that can help users get familiar with its features and functions.

5. Can Mathematica be used for real-world applications?

Yes, Mathematica is commonly used in various industries such as finance, engineering, and research for its powerful mathematical and computational capabilities. It can be used to solve complex problems and make predictions based on data analysis.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
18
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top