how to solve an equation with two unknowns
Show older comments
Hello,
I have this equation
y = (n*p)*(1-p)^(n-1);
I want to take the derivative and let it equal to zero to find out p, which should be 1/n as a result!
I could get the derivative for this equation manually and using MATLAB, the result is:
dydp = n*(1 - p)^(n - 1) - n*p*(n - 1)*(1 - p)^(n - 2))
However, I couldn't solve it as the way mentioned above to find p!
p = 1/n, i could do it manually. How can i find it using MATLAB??
Regards
3 Comments
Image Analyst
on 14 Jul 2019
Hints: fsolve(), fzero(), roots(). Is this homework?
fatima alansari
on 14 Jul 2019
Answers (1)
Jyotsna Talluri
on 17 Jul 2019
Hi,
For solving the equation with 2 variables,you can use the solve() function
syms n
syms p
p=solve(n*(1 - p)^(n - 1)-n*p*(n - 1)*(1 - p)^(n - 2)==0,p);
Categories
Find more on Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!