Using solve and sigma from programming
03-30-2021, 12:33 AM
Post: #1
 photometer Junior Member Posts: 6 Joined: Mar 2021
Using solve and sigma from programming
Hello,
I have an equation

pv = cf/(1+r) + cf/(1+r)^1 + cf/(1+r)^2 + ... + cf/(1+r)^n

I have the value of pv, cf and I need to find the value of r. How do I call the CAS.solve() and pass a function that does summation?

BEGIN
LOCAL pv,cf,result;
pv:= 100;
cf:= 10;
result:=CAS.solve(.....); // <- how do I write this?

END;
03-30-2021, 01:43 PM (This post was last modified: 03-30-2021 03:00 PM by roadrunner.)
Post: #2
 roadrunner Senior Member Posts: 359 Joined: Jun 2015
RE: Using solve and sigma from programming
I deleted my previous post because i had an error in the program.

I'm thinking this:

PHP Code:
EXPORT testsum()BEGIN LOCAL pv,cf,result; pv:=100; cf:=10; result:=CAS(EVAL("solve("+pv+" = (sum("+cf+"/(1+r)^n,n,0,∞)),r)")); return result;END;

is what you are looking for?

-road
03-30-2021, 10:53 PM
Post: #3
 photometer Junior Member Posts: 6 Joined: Mar 2021
RE: Using solve and sigma from programming
Thanks very much. It works now.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)