Write a function in terms of another function

Hello All, I have 2 functions that are polynomials. For example: F=x1^2+x2^2+2x1x2 and G=(x1+x2)^4 I need to write one of these two functions in terms of the other one. For the example above the answer would be: G as a function of F is: G=F^2 As you know, depending on the complexity of F and G, doing such a manipulation can be very difficult. Therefore, I am wondering if I can use MATLAB to do this. Thank you!

Réponses (1)

the cyclist
the cyclist le 14 Mai 2018
I think this does what you want
F = @(x1,x2)(x1.^2 + x2.^2 + 2*x1.*x2)
G = @(f)f.^2
Call this, for example, as
G(F(1,1))

2 commentaires

mehdi
mehdi le 14 Mai 2018
Modifié(e) : mehdi le 14 Mai 2018
Hello thanks for the answer but this is not what I need.Please not this is a very basic example and we dont know the correct answer is G=F^2. So we can't give it to Matlab. Matlab is supposed to give us this answer. The only things we know are F and G in terms of x. So, probably we should say: F = @(x1,x2)(x1.^2 + x2.^2 + 2*x1.*x2) G = @(x1,x2)(x1+x2).^4 but I still don't know how to extract G in terms of F (which is G=F^2).
the cyclist
the cyclist le 14 Mai 2018
Ah. Sorry for my misunderstanding.

Connectez-vous pour commenter.

Catégories

Question posée :

le 14 Mai 2018

Commenté :

le 14 Mai 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by