Message Boards Message Boards

0
|
829 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Defining a function that depends on a custom function

Posted 1 year ago

I am trying to define a function that is itself based off the results of other functions:

cpr[x_, i_, n_] := [cpm[x, i, n]/pxl[n, i]]

where:

cpm[x_, i_, n_] := Product[pm[x, i], {x, 1, n}]

and I want it to change to change its behavior every time that cpr < 1.

Specifically, I'd like to write this function such that x substracts the previous n required to cause cpr <1 and have i increase by one every time cpr<1 until the sum of all n's equals a predefined upper bound.

Any insights would be greatly appreciated!

POSTED BY: Brandon Clarke
Posted 1 year ago

First, I would suggest you provide some test cases. Some examples of how inputs get mapped to outputs would be helpful.

When you say

I want it to change to change its behavior every time that cpr < 1

I can't quite figure out what "its" refers to. If it refers to the function cpm, then we have a problem, because cpr depends on cpm. If it refers to cpr, then why don't you just define cpr the way you want?

When you say

such that x substracts the previous n

How do you define "previous n"? Is n an integer? Do you mean n-1?

The rest of that sentence made my head spin.

Just give us a table of "test cases" with rows like this:

{x, i, n, cpr, cpm}

where each entry is an actual value or expression that illustrates your rules.

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract