kubaPod / MoreCalculus

Developement repository for MoreCalculus Mathematica package
9 stars 4 forks source link

Unexpected result when changing dependent variable #7

Closed dpholmes closed 2 years ago

dpholmes commented 2 years ago

It's quite likely this is just a syntax/implementation on my side, and so apologies if I'm wasting your time.

I'm trying to do a change of variable in the following equations:

eq = x''[t] == -((g R^2)/(R + x[t])^2);
ic1 = x'[0] == v0;
ic2 = x[0] == 0;

Change of variable:

u=x/xc
s=t/tc

Code: DChange[{eq, ic1, ic2}, {u == x/xc, s == t/tc}, {x, t}, {u, s}, x[t]]

Output: {u''[s]/tc^2 == -((g R^2)/(R + u[s])^2), v0 == u'[0]/tc, u[0]==0}

Expected Output: {xc u''[s]/tc^2 == -((g R^2)/(R + xc u[s])^2), v0 == xc u'[0]/tc, u[0]==0}

The characteristic value xc doesn't appear in any of the equations, and I can't figure out why.

dpholmes commented 2 years ago

Yep, I'm a fool. I learned from this stackexchange that I was using the syntax for changing the independent variable(s). Once I do a second substitution using the syntax: DChange[%, u[t] == xc u[t]] (where % is assuming you run this code directly after my original DChange command), MMA gives the expected output.