Cannot solve a system of equations

26 views
Skip to first unread message

Roustam Shaitan

unread,
Aug 1, 2020, 5:09:58 AM8/1/20
to FriCAS - computer algebra system
Hello,

Why do I get an empty list at (8) as a result of the following commands?

(1) v:=operator 'v
(2) m*a=-m*g-k*v(t)
(3) subst(%% 2, a=D(v(t),t))
(4) solve(%% 3, v, t=0, [V0])
(5) integrate(%% 4, t=0..t)
(6) subst(%% 5, [V0=Vx, g=0]) = s
(7) subst(%% 5, V0=Vy) = 0
(8) solve([%% 6, %% 7], [s, t])

Best regards,

Roustam

Roustam Shaitan

unread,
Aug 1, 2020, 6:54:13 AM8/1/20
to FriCAS - computer algebra system
Please find attached the input file.
projectile.input

Ralf Hemmecke

unread,
Aug 1, 2020, 7:17:51 AM8/1/20
to fricas-devel
I already see "no solution" for the i2 expression alone, see below.
And if I enter this in Mathematica.

e = (-g*m^2 - Vy*k*m)*Exp[-k*t/m] - g*k*m*t + g*m^2 + Vy*k*m
Solve[e == 0, t]

I get:

===================================================================
During evaluation of In[2]:= Solve::ifun: Inverse functions are being
used by Solve, so some solutions may not be found; use Reduce for
complete solution information.

Out[2]= {{t -> (
g m + k Vy +
g m ProductLog[-((E^(-1 - (k Vy)/(g m)) (g m + k Vy))/(g m))])/(
g k)}}

https://reference.wolfram.com/language/ref/ProductLog.html
===================================================================
Maple gives:

solve((-g*m^2 - Vy*k*m)*exp(-k*t/m) - g*k*m*t + g*m^2 + Vy*k*m, t);
0

===================================================================
I don't know wether this makes you happy or sad.

Ralf

===================================================================
(1) -> v:=operator 'v

(1) v
Type:
BasicOperator
(2) -> equ := m*a=-m*g-k*v(t)

(2) a m = - k v(t) - g m
Type:
Equation(Expression(Integer))
(3) -> equ1 := subst(equ, a=D(v(t),t))

,
(3) m v (t) = - k v(t) - g m

Type:
Equation(Expression(Integer))
(4) -> sol := solve(equ1, v, t=0, [V0])

k t
- ---
m
(g m + V0 k)%e - g m
(4) -------------------------
k
Type:
Union(Expression(Integer),...)
(5) -> i := integrate(sol, t=0..z)

k z
- ---
2 m 2
(- g m - V0 k m)%e - g k m z + g m + V0 k m
(5) --------------------------------------------------
2
k
Type: Union(f1:
OrderedCompletion(Expression(Integer)),...)
(6) -> i1 := subst(i, [V0=Vx, g=0]) = s

k z
- ---
m
- Vx m %e + Vx m
(6) --------------------- = s
k
Type:
Equation(Expression(Integer))
(7) -> i2 := subst(i, V0=Vy) = 0

k z
- ---
2 m 2
(- g m - Vy k m)%e - g k m z + g m + Vy k m
(7) -------------------------------------------------- = 0
2
k
Type:
Equation(Expression(Integer))
(8) -> h := solve([i1,i2], [s, z])

(8) []
Type:
List(List(Equation(Expression(Integer))))
(9) -> h1 := solve([i1], [s, z])

- k s + Vx m
m log(------------)
Vx m
(9) [[z = - -------------------]]
k
Type:
List(List(Equation(Expression(Integer))))
(10) -> h2 := solve([i2], [z])

(10) []
Type:
List(List(Equation(Expression(Integer))))

Waldek Hebisch

unread,
Aug 1, 2020, 7:24:05 AM8/1/20
to fricas...@googlegroups.com
This is limitation of current solver, it can not do much
in multivariate case when there are transcendental functions.

In this case substituting variable for 'exp(-k*t/m)' or
just command like:

solve(..., [s, exp(-k*t/m)])

works.

--
Waldek Hebisch

Roustam Shaitan

unread,
Aug 2, 2020, 3:55:41 AM8/2/20
to FriCAS - computer algebra system
Here is what Wolfram Mathematica can solve:

[1]  m*a==-m*g-k*v[t]
[2]  %1/.a->v'[t]
[3]  DSolve[{%2, v[0]==V0}, {v[t]}, {t}]
[4]  Simplify[%3/.k->n*m]
[5]  (v[t]/.%4)[[1]]
[6]  Integrate[%5, {t, 0, t}]
[7]  (%6/.{V0->Vx, g->0})==s
[8]  (%6/.{V0->Vy})==0
[9]  Reduce[{%7, %8}, {s, t}]
[10] Simplify[%9 && g!=0 && n!=0 && Vx!=0 && Vy!=0]/.C[1]->0

In Out[10] there is an equation for s with Lambert function W. Can I get to that equation in FriCAS?

I don't have Wolfram Mathematica. I tried to reproduce steps from this video.

Roustam Shaitan

unread,
Aug 2, 2020, 3:59:57 AM8/2/20
to FriCAS - computer algebra system
I have also tried to apply k->n*m but it didn't help. Maybe I did it wrong.

Roustam Shaitan

unread,
Aug 2, 2020, 8:33:15 AM8/2/20
to FriCAS - computer algebra system
What I really need is to solve the system for s but solve([%% 6, %% 7], [s]) also gave me an empty list. I only added t because in Mathematica Reduce[{%7, %8}, {s, t}] gives several solutions one of which contains the sought equation for s [but after replacing k with n*m beforehand]. [s, exp(-k*t/m)] suggested by you gives the equation (6) solved for exp(-k*t/m) which is not what I want.

Waldek Hebisch

unread,
Aug 2, 2020, 9:52:57 AM8/2/20
to fricas...@googlegroups.com
On Sun, Aug 02, 2020 at 05:33:15AM -0700, Roustam Shaitan wrote:
> What I really need is to solve the system for s but solve([%% 6, %% 7],
> [s]) also gave me an empty list. I only added t because in Mathematica
> Reduce[{%7, %8}, {s, t}] gives several solutions one of which contains the
> sought equation for s [but after replacing k with n*m beforehand]. [s,
> exp(-k*t/m)] suggested by you gives the equation (6) solved for exp(-k*t/m)
> which is not what I want.

I see, FriCAS lives dependence on t in implicit form (unsolved).
This dependece can be soved using lambertW, but ATM FriCAS does
not make use of lambertW for solving.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages