Ask Your Question
0

How to split a function into separate components (according to their variables)?

asked 2024-11-22 10:40:30 +0100

Afandi_MohAlsh gravatar image

updated 2024-11-22 10:43:20 +0100

Hello there,

I had come across this question on the MATLAB Help Center website and was wondering if there was an equivalent answer in Sage......

if I defined an equation/function as below

x1, x2, y1, y2 = var("x1, x2, y1, y2")

f = 10*x1 + 20*x2 + 10*y1 + 10*y2

how can I split it as below ? :

f_x1 = 10*x1 ;
f_x2 = 20*x2 ; 
f_y1 = 10*y1 ; 
f_y2 = 20*y2 ;

I'd appreciate any suggestions.....

--Moh

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2024-11-22 11:18:23 +0100

FrédéricC gravatar image

like this

sage: f.operands()
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-11-22 10:40:30 +0100

Seen: 33 times

Last updated: yesterday