Implementing Desmos Function into Java

I've got a function in desmos and want to convert it into java, but I can't figure out how I would put this:
No description
34 Replies
JavaBot
JavaBotā€¢6mo ago
āŒ› This post has been reserved for your question.
Hey @š“pothicon! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
š“pothicon
š“pothiconOPā€¢6mo ago
The Sigma symbol is what i cant figure out
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
so it would just be like a+the stuff in the parenthesis?
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
ah so if this is being used for a noise then i would probably not do something like that n would just be a coordinate? because im not sure what i would want to loop it to otherwise theres no number i want to reach
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
this is the whole thing
No description
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
a is amplitude so 4.1 looks like this
No description
š“pothicon
š“pothiconOPā€¢6mo ago
and 2.4 looks like this
No description
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
yes wait no 4.5 and 4.9 look the same but 4.0 doesnt
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
i do? well ig i do a = 5 (5 was the same as 4.1) but that doesnt change anything
double f = Mth.sin(x);
int amplitude = 5;
double stretch = 0.01;
int height = 320;
int e = 0;
int n = 1;
double mountain = amplitude+((f*((e^n)*stretch*x)*height)/(e^n));
double f = Mth.sin(x);
int amplitude = 5;
double stretch = 0.01;
int height = 320;
int e = 0;
int n = 1;
double mountain = amplitude+((f*((e^n)*stretch*x)*height)/(e^n));
this is what i have but it doesnt create the same result but yeah if im not supposed to add a (amplitude) to it then maybe that was the problem but it has to be factored in somehow also not sure what to do about e and n since theres no loop and i dont see what i would loop if there was one ok i think i figured out the looping part its what creates the extra details based on the amplitude
double f = Mth.cos(x);
int amplitude = 5;
double stretch = 0.01;
int height = 320;
double mountain = 0;
for (int e = 1; e<= amplitude; e++) {
mountain += (f*((Math.pow(e, 1))*stretch*x)*height)/(Math.pow(e, 1));
}
double f = Mth.cos(x);
int amplitude = 5;
double stretch = 0.01;
int height = 320;
double mountain = 0;
for (int e = 1; e<= amplitude; e++) {
mountain += (f*((Math.pow(e, 1))*stretch*x)*height)/(Math.pow(e, 1));
}
so i got this now not sure if thats what e is supposed to be though and i know n isnt supposed to be "1" but i couldnt figure out what else it would be i think the main problem im having with understanding this is in desmos e is never defined so i have no idea where its getting the e from
š“pothicon
š“pothiconOPā€¢6mo ago
this is what it looks like with "e"
No description
š“pothicon
š“pothiconOPā€¢6mo ago
this is with "e" replaced with "3"
No description
š“pothicon
š“pothiconOPā€¢6mo ago
so whatever "e" is its making sure that everything doesnt look identical
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
what is this loll
No description
š“pothicon
š“pothiconOPā€¢6mo ago
just a random variable for 2.7182...
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
idk what logarythm means
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
ahh
š“pothicon
š“pothiconOPā€¢6mo ago
alr i got this now
No description
š“pothicon
š“pothiconOPā€¢6mo ago
still isnt creating the same result as in desmos though
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
well i cant calculate the entire graph all at once that would probably freeze this is inside of a function that runs at each coordinate
Unknown User
Unknown Userā€¢6mo ago
Message Not Public
Sign In & Join Server To View
š“pothicon
š“pothiconOPā€¢6mo ago
it works in desmos though
š“pothicon
š“pothiconOPā€¢6mo ago
see
No description
š“pothicon
š“pothiconOPā€¢6mo ago
just isnt translating to java for some reason did i do the looping part wrong? nah looks like even if i dont do the looping it still isnt anything like that also what original equation are you referring to? thats the first part of the whole thing theres no original or nothin well ig you could say it is the original
JavaBot
JavaBotā€¢6mo ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server