Dsolve: assigning constants of integration and subscripts

In summary, the user is trying to solve an equation using Mathematica and wants to replace the constants of integration with chosen variables. They have tried using the GeneratedParameters function, but it did not work. They are also wondering how to change the subscript of one of the variables. A solution is suggested to replace the parameters at the end of the equation, or to use o instead of 0 in the subscript, or to put the subscript in a string. Another solution is to get the constants from the equation by plugging in boundary conditions.
  • #1
KleZMeR
127
1
I have an equation I am solving with Mathematica:

In:

DSolve[y''[t] +
Subscript[\[Omega], c]^2 y[
t] == -Subscript[\[Omega], c]^2 Subscript[v, d]*t +
Subscript[\[Omega], c]*Subscript[v, 0], y[t], t]

Out:

{{y[t] ->
C[2] Cos[t Subscript[\[Omega], c]] +
C[1] Sin[t Subscript[\[Omega], c]] + (
Subscript[v, 0] - t Subscript[v, d] Subscript[\[Omega], c])/
Subscript[\[Omega], c]}}



I would like to replace the two constants of integration(C[1], C[2]) with two chosen variables

If I include this with the DSolve command:

{C[1] -> (Voy/omega), C[2] -> ((Voy-Vd)/omega)},

it returns that I can not use these for variables.

I have also found a GeneratedParameters-> function, but it does not work either,.. and if I'm correct, the GeneratedParameters-> Module{C[1], C[2]..&} function is only to ensure that C[] values are all unique, and does not change their representation.


I am also wondering how to change the subscript of Vo into Voy, Mathematica is not letting me do this.

Again, any help would be appreciated
Thanks
 
Physics news on Phys.org
  • #2
You can replace the parameters all the way at the end:

DSolve[ ..., y[t], t] /. {C[1] -> ..., C[2] -> ...}

and that works well for me.

When you type V0y Mathematica sees the subscript as an expression, and replaces 0*y by 0 (which is usually very handy, but not what you want now). You can use o (letter oh) instead of 0 (number zero) in the subscript, or put it in a string: V"y,0".
 
  • #3
Or you can use

GeneratedParameters -> ((Voy - (# - 1) Vd)/omega &)
 
  • #4
And of course the neatest solution is to just get them from the equation by plugging in the right boundary conditions:

DSolve[{equation, y'[0] == v0y, y[0] = 0}, y[t], t]

or something like that.
 

What is Dsolve?

Dsolve is a function in scientific computing that is used to solve ordinary differential equations (ODEs). It uses numerical methods to find the solution to a given ODE.

How do I assign constants of integration in Dsolve?

To assign constants of integration in Dsolve, you can use the "C" symbol followed by a number, such as C1, C2, etc. These constants will be used in the general solution of the ODE and can be solved for using initial conditions.

Can I use subscripts in Dsolve?

Yes, you can use subscripts in Dsolve by using the underscore "_" symbol followed by the subscript number. For example, C_1, C_2, etc. These subscripts are used to differentiate between different constants of integration.

Why is it important to assign constants of integration in Dsolve?

Assigning constants of integration in Dsolve is important because it allows you to find the specific solution to an ODE, rather than just the general solution. These constants are determined by the initial conditions of the problem and can change the behavior of the solution.

Are there any limitations to using Dsolve?

Yes, there are some limitations to using Dsolve. It may not be able to find a closed-form solution for all types of ODEs, and it may also have difficulty in solving certain types of boundary value problems. In these cases, alternative methods may need to be used.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
544
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
256
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
217
  • Introductory Physics Homework Help
Replies
10
Views
260
  • Introductory Physics Homework Help
Replies
17
Views
373
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • Special and General Relativity
Replies
16
Views
920
Back
Top