cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

I don't know the reason error is generated

jlee-2
7-Bedrock

I don't know the reason error is generated

K-6.pngK-7.png

I got error in left of the picture. so I did tracking. and I knew first error by using traking.

But I can't understand the reason that error is generated.

error is said that you can't divide '0'.

3 REPLIES 3
Werner_E
25-Diamond I
(To:jlee-2)

This is basically the same question you posted two hours ago and just marked as "being answered".

Its the same error and its NOT a division by zero!

In the sheet you posted you also can not track the error at all because of the equal sign after the definition of the function a.r(mu). If I delete that equal sign and add a a.r(mu)=.. after the definition I get the error and now it can be traced.

The reason is exactly what the error message says - you defined g.1(a,mu) as a function with two arguments, but 2 lines later you call it with just one argument.

1.png

The next error will occur when you use c(my). c is a vector defined in a table, not a function. In Prime you may access individual elements of a vector either by using the vector index (which is the preferred way) or by using the same syntax as when you call a function (which I find confusing). So c[1= and c(1)= will give you the same result. But of course the index has to be valid, so it at least has to be an integer. You use c(mu) and mu is a range of non-integer values which sure has to throw an error.

One other thing I just notice is that the first "else if" in your routine is not followed by a condition but by the assignment of a range for mu!?

I am not sure why you are working with ranges and vectors all the time, Wouldn't it be more convenient to set up your whole calculation as functions which yield single scalar values and then later call it with a vector (not a range) as argument?

P.S.: With the file you attached I don't experience the second error your screenshot shows.

jlee-2
7-Bedrock
(To:Werner_E)

Thank you for advice.

But I am sorry because I don't understand well.

So, Could you explain easily?

Werner_E
25-Diamond I
(To:jlee-2)

jinsuk Lee wrote:

Thank you for advice.

But I am sorry because I don't understand well.

So, Could you explain easily?

Not sure how and what exactly.

1) I don't see the "division by zero error" you are talking about

2) The first error you showed is because you used g1(mu) where you should probably have used g1(a, mu) as I had highlighted in yellow.

3) I predicted further errors because at first you define a function c(mu) but later you overwrite that function by a tabled vector c.

4) I was confused when I looked at your routine for a.r because you used something like "if mu <-- 0.05,0.1..0.3". After "if" there should always be a condintional expression, something which returns either true or false. In Mathcad false is equal to zero and everything different from zero is interpreted as true.

Hope this helps!

Announcements

Top Tags