# [R] Recherche de fonction

Berend Hasselman bhh at xs4all.nl
Wed Jul 10 21:02:28 CEST 2013

```On 10-07-2013, at 20:42, Berend Hasselman <bhh at xs4all.nl> wrote:

>
> On 10-07-2013, at 16:21, Raphaëlle Carraud <raphaelle.carraud at oc-metalchem.com> wrote:
>
>> Bonjour,
>>
>> Je souhaite  résoudre le couple d'équation différentielles suivant :
>>
>>   0 = -dA + dB + 2*dC - 2*r1 - 2*r5
>>   0 = dA + dD + r1 + r4
>>   0 = K2 - C/B^2
>>   0 = K3 - D/(A*B)
>>
>>   0 = r5 + 2*r4 - dE
>>   0 = r5 -dI
>>   0 = -r5 - r4 - dG
>>   0 = -r1/2 - dH
>>
>> en ayant connaissance des valeurs initiales de dA, dB, dC, dE, dI, dG, dH, r1, r2, r4, r5, K2, K3, A, B, C et D.
>>
>
> If all initial values are known then plugging the values in the system will give 0 or not 0. There is nothing to "solve".
>
>> J'ai essayé plusieurs fonctions mais comme je ne peux pas lui faire calculer une des dérivée de laquelle découlerait les autre, il n'arrive pas à me fournir la solution.
>> Je n'ai pas vu d'exemple qui pourrai s'assimiler à celui-ci dans la documentation.
>>
>
> You will have to redo your query in English. Questions in French won't receive many replies.
> My French is rudimentary but I'll try.
>
> You have 8 equations and 17 variables.
> So how do you propose to "solve" the system?
>
> Assuming that the d? variables are differentials and that you want to solve for those:
> you have 7 of these and 8 equations. So how to solve?
>
> But the third and fourth equations have no d? variables, so the may even be inconsistent given the values of K2, K3, C, B, A, D.
> So you have 6 equations for 7 d? variables. So how do you propose to solve for the d? variables?
>
> Finally your system seems to be linear in the d? variables. You would be able to use R's solve()  if you can get your system to be a square system.
>
> If your system is not square and underdetermined then you can use a Moore Penrose inverse to get a minimum norm solution
> (http://en.wikipedia.org/wiki/Moore–Penrose_pseudoinverse#Minimum-norm_solution_to_a_linear_system).
> package MASS provides a function ginv().

And to make matters simple: since your lefthand sides are 0 the minimum norm solution of your system is 0.

Berend

```